Coupon Accepted Successfully!


Nested for Loops

We can also nest for loop to gain more advantage in some situations. The nesting level is not restricted at all. In body of a ‘for’ loop any number of sub -‘for’ loop(s) may exist.

6.5 Write a program to demonstrate nested for loops.

Explanation: The above program will be executed in sequence as per Table. The total numbers of iterations are equal to 2*2*2 = 8. The final output provides 8 results.

Table: Working and output of program 6.5

Test Your Skills Now!
Take a Quiz now
Reviewer Name