C Language



Admission Enquiry Form

  

Nested For loop in C

What is Nested For loop in C?

Nested For loop is a For loop inside another For loop.

Syntax of Nested For loop

for(initialization;condition;increment/decrement)
{
for(initialization;condition;increment/decrement)
{
//statements.
} //end of inner loop
} //end of outer loop



Example of Nested For loop:


Output:

***
***
***

In the above example, a star pattern will we printed in 3 rows and 3 columns format.Rows will be printed by the outer loop and columns will be printed by inner loop