write a java program to print the following pattern
A
B C
D E F
G H I J
Answers
Answered by
0
CⓞDE
import java.utill.*;
class JavaPattern1 {
public static void main(String args[]) {
int i;
int j;
int n = 4;
int k = 1;
for (i = 1; i <= n; i++)
for (j = 1; j <= i; j++, k++)
{
System.out.printf("%4c", (char) (k + 64));
}
System.out.println("");
}
}
}
OUTPUT
A
B C
D E F
G H I J
Attachments:
Similar questions