0
is there easy way to understand nested loop and not get confused?
3 RĂ©ponses
+ 3
Practise helps. I also put 2 print statements. One in each loop (although you could just use one).
In your first loop, say you're using int i,
Then print that, second loop, using int j, print that.
You should have something like
i = 0
j = 0
j = 1
j = 2
i = 1
j = 0
j = 1
j = 2
i = 2
j = 0
j = 1
j = 2
Does that help?
0
Ye aap kaisa hi bhi