three nested for loop in c code example
Example: how to create a nested for loop in c
//Nested for loop in C
int main()
{
for (int i=0; i<2; i++)
{
for (int j=0; j<4; j++)
{
printf("%d, %d\n",i ,j);
}
}
return 0;
}
//Alternative approach to nested for loop
int main()
{
int i,j;
for (i=1,j=1 ; i<10 || j<10; i++,j++)
{
printf("%d, %d\n",i ,j);
}
return 0;
}