The for loop continues to execute as long as the condition is true. Once the condition becomes false, program execution resumes on the statement following the for.
The general design of the for loop is reflected in some form or another in all procedural programming languages. The for allows us to specify three things about a loop in a single line so, it is probably the most popular looping instruction.
for ( initialization; condition; increment )
{
Statements to be execute ;
.
.
}
where,
» The initialization is an assignment statement that is used to set the loop counter to an initial value.
» The condition is a relational expression that determines when the loop exits or it testing the loop counter to determine whether its value has reached the number of repetitions desired.
» The increment defines how the loop control variable changes each time the loop is repeated.
» We must separate these three major sections by semicolons ( ; ).
\* C Program to show the use of do-while Loop *\
# include < stdio.h >
int main( )
{
int i ;
for ( i = 1; i < = 10; i ++ )
{
printf("\n %d ", i) ;
}
return ( 0 );
}