Java Pattern Programs
Write a program in Java to display the following pattern:
A
AB
ABC
ABCD
ABCDE
Java
Java Nested for Loops
18 Likes
Answer
public class KboatPattern
{
public static void main(String args[]) {
for (char i = 'A'; i <= 'E'; i++) {
for (char j = 'E'; j > i; j--) {
System.out.print( " ");
}
for (char k = 'A'; k <= i; k++) {
System.out.print(k);
}
System.out.println();
}
}
}
Output
Answered By
7 Likes