-one for statement within another for statement is allowed in C.
-In nested for loops one or more for statement are included in the body of the loop.Syantax :
for(initialize;test condition;updations)
{
for(initialize;test condition;updation)
{
Body of loop;
}
}
Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=10;j++)
{
printf("\n Computer");
}
}
getch();
}
Output:
50 times
Computer
No comments:
Post a Comment