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