how to create a nested for loop in c

Solutions on MaxInterview for how to create a nested for loop in c by the best coders in the world

showing results for - "how to create a nested for loop in c"
Lucia
29 Feb 2016
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