Nested loops with Same max values in C

Notes:

Nested loops with Same max values in C Programming Language:

Nested Loops in C:
- If required we can place one loop inside another loop, which is called as nesting of loops.

Nested for loops:
- If we place one for loop inside another for loop; which is called nested for loops or nested for statement.

Case 1: nested for loops with same max values, are called quadratic loops

for(i=0; i<n; i++) // outer for loop
{
for(j=0; j<n; j++) // inner for loop
{
sequence of statement(s); // n x n times
}
}

Ex: 1
int i=0;
int j=0;

for(i=0; i<2; i++)
{
for(j=0; j<2; j++)
{
printf("Hello World\n"); // 2 x 2 = 4 times
}
}

Ex: 2
int i=0;
int j=0;

for(i=0; i<3; i++)
{
for(j=0; j<3; j++)
{
printf("Hello World\n"); // 3 x 3 = 9 times
}
}