Sara Hajrizi

Sara Hajrizi

  • 1.7k
  • 11
  • 2.1k

Write a program to simulate n nested loops from 1 to n.

Oct 19 2023 9:20 PM

Create a recursive method Loops(int k), perform a for-loop from 1 to n and make a recursive call Loops(k-1) in the loop. The bottom of the recursion is when k < 0. Initially invoke Loops(n-1).


Answers (3)