PALINDROMIC Pattern with Numbers pattern Java Programming Code

PALINDROMIC Pattern with Numbers pattern


Code :

public class PALINDROMICpatternWithNumbers {
    public static void main(String[] args) {
        // Outer Loop
        int n = 9;
        for (int i = 1; i <= n; i++) {
            // spaces
            for (int j = 1; j <= n - i; j++) {
                System.out.print(" ");
            }
            // descending
            for (int j = i; j >= 1; j--) {
                System.out.print(j);
            }

            // ascending
            for (int j = 2; j <= i; j++) {
                System.out.print(j);
            }

            System.out.println(" ");

        }
    }
}

ASDF...

No comments:

Post a Comment

Max Sub Array Sum: Kadane's Algorithm

Code of: Max Sub Array Sum: Kadane's Algorithm. public class MaxSubArraySumKadanesALgorithm {     public static void Kadane ( int ...