New course! Every coder should learn Generative AI!
Try a free lesson+ 1
print this pattern
1 2 2 3 0 3 4 0 0 4 5 0 0 0 5
1 Answer
0
for(int i=1;i<=5;i++) {
for(int j=0;j<i;j++) {
System.out.print(j==0 || j==i-1 ? i : 0);
}
System.out.println();
}