20 lines
408 B
Java
20 lines
408 B
Java
public class ReverseNestedLoop {
|
|
public static void main(String[] args) {
|
|
// 1
|
|
// 2 3
|
|
// 4 5 6
|
|
// 7 8 9 10
|
|
// we need to create a nested loop that can print this pyramid.
|
|
|
|
int r = 1;
|
|
for (int i = 1; i <= 4; i++) {
|
|
System.out.println("");
|
|
for (int j = 1; j <= i; j++) {
|
|
System.out.print(j);
|
|
System.out.print("\t");
|
|
// r++;
|
|
}
|
|
}
|
|
}
|
|
}
|