diff --git a/ReverseNestedLoop.java b/ReverseNestedLoop.java new file mode 100644 index 0000000..bc6a7fe --- /dev/null +++ b/ReverseNestedLoop.java @@ -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++; + } + } + } +}