Nested loop

Loop will repeat statements. Each repetition is called an iteration.A loop can be nested as many times as required. To avoid complexity we show a loop inside another loop. All iteration of inner loop will be completed during each iteration of immediate outer loop.
Example:

 

OUTPUT

Outer loop iteration 1
Inner loop iteration 1
Inner loop iteration 2
Inner loop iteration 3
Inner loop iteration 4
Outer loop iteration 2
Inner loop iteration 1
Inner loop iteration 2
Inner loop iteration 3
Inner loop iteration 4
Outer loop iteration 3
Inner loop iteration 1
Inner loop iteration 2
Inner loop iteration 3
Inner loop iteration 4
Outer loop iteration 4
Inner loop iteration 1
Inner loop iteration 2
Inner loop iteration 3
Inner loop iteratio


Next Previous