How to understand nesting loops in C Language
Nesting Loops
On this page
Nesting Loops
Program to Understand Nesting Loops in C Language
#include <stdio.h>
int main()
{
int i, j;
for (i = 1; i <= 3; i++)
{
printf("i = %d\n", i);
for (j = 1; j <= 4; j++)
{
printf("j = %d\t", j);
}
printf("\n");
}
return 0;
}
Output
i = 1
j = 1 j = 2 j = 3 j = 4
i = 2
j = 1 j = 2 j = 3 j = 4
i = 3
j = 1 j = 2 j = 3 j = 4