BismiALLAH
This commit is contained in:
parent
abbf8a7794
commit
e8528bbdf3
19
ReverseNestedLoop.java
Normal file
19
ReverseNestedLoop.java
Normal file
@ -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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user