1//Nested for loop in C
2int main()
3{
4 for (int i=0; i<2; i++)
5 {
6 for (int j=0; j<4; j++)
7 {
8 printf("%d, %d\n",i ,j);
9 }
10 }
11 return 0;
12}
13//Alternative approach to nested for loop
14int main()
15
16{
17 int i,j;
18 for (i=1,j=1 ; i<10 || j<10; i++,j++)
19 {
20 printf("%d, %d\n",i ,j);
21 }
22 return 0;
23
24}
25