For loop in c
For loop is useful to execute the particular statement on the basis of certain condition. It is also called counter loop useful when we know the exact number of repetition.
The General Format is:
for(initialization; condition; increment/decrement)
{
//body to repeat;
}
Example:
Q. Write a c program to print 1 to 100.
Ans.
#include<stdio.h>
#include<conio.h>
void main()
{
int i;
for(i=0;i<100;i++)
{
printf(“%d”,i);
}
getch();
}