Computer Science, asked by AnushreeH1592, 1 year ago

Example programming for nested for loop explanation

Answers

Answered by gurukulamdivya
4

Answer:

C programming language supports nesting of one loop inside another. You can define any number of loop inside another loop. You can also have any number of nesting level. You can put any type of loop in another type. For example, you can write a for loop inside while loop, while inside another while etc.

For example: C program to print multiplication table from 1 to 5

#include <stdio.h>

int main()

{

   /* Loop counter variable declaration */

   int i, j;

   /* Outer loop */

   for(i=1; i<=10; i++)

   {

       /* Inner loop */

       for(j=1; j<=5; j++)

       {

           printf("%d\t", (i*j));

       }

       /* Print a new line */

       printf("\n");

   }

   return 0;

}

Similar questions