For loop in C language by R4R Team

for loop is the Entry control loop in C language

Syntax-

for(statement1,statement2,statement4)
{
statement3;
}

Example-
for(i=0;i< 5;i++)
{
}

for(i=10;i>0;i--)
{
}


program-

#include< stdio.h>
int main()
{
int i;
printf("Before For Loop\n");
for(i=0;i< 10;i++)
{
printf("Inside loop i=%d\n",i);
}
printf("After Loop");
}


output-

Before For Loop
Inside Loop i=0
Inside Loop i=1
Inside Loop i=2
Inside Loop i=3
Inside Loop i=4
Inside Loop i=5
Inside Loop i=6
Inside Loop i=7
Inside Loop i=8
Inside Loop i=9
After Loop

-In this program, we start with the i=0;
-then we run the for loop until i become 10




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!