BismiALLAH
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
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(r);
|
||||||
|
System.out.print("\t");
|
||||||
|
r++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user