Print Half Pyramid Character Pattern Java Programming Code

  Output:

Simple Java Code:

public class printCharacterPatternHalfPyramid {
    public static void main(String[] args) {
        int n = 7;
        char ch = 'A';
        for (int i = 1; i <= n; i++) {
            // number print
            for (int num = 1; num <= i; num++) {
                System.out.print(ch);
                ch++;
            }
            System.out.println();
        }
    }
}

...



java .\printCharacterPatternHalfPyramid.java

A

BC

DEF

GHIJ

KLMNO

PQRSTU

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 ...