for loop is used to repeat execution of specific part of program till condition satisifes.it works like while loop but for loop is easy then while loop when understanded properly.
Syntax:
for(init;condition;increment or decrement)
{
statements;
}
Example program for for loop:
#include<stdio.h>
#include<conio.h>
main()
{
int a;
clrscr();
for(a=1;a<=10;a++)
{
printf("%d,",a);
}
getch();
}
#include<conio.h>
main()
{
int a;
clrscr();
for(a=1;a<=10;a++)
{
printf("%d,",a);
}
getch();
}