for (init; cond; end) { block}
init; while (cond) { block; end; }
for (i=1; i <= 10; i++) { printf("%d\n", i); }
! # c = c+1 # ! c = c - 1 () # * c% # +
"
$++% &
'
$-- %&
'
'
$++c
–
,
() # * -% #
'
$c++ ,
c-
!
"
() #*
'
$++c
–c% #+
,
() #* -- % c #
'
$c++ ,
! # 'c = 5, – printf(“%d”,++c); ' ' – printf(“%d”,c++); ' '%
" 6 $c % 5$
' -
! # * + () ' ' ++c; printf(“%d”, c); c++; printf(“%d”,c);
' '
"
'. / # . (0
&.
& '
$
% (0 (0 ' (0
'
$
' ' $ ,% % '
'. /
&.
# int counter =1; /*initialization */ while (counter <= 10){ /* repetition condition */ printf(“%d \n”, counter); ++counter; /*increment */
}
0 ' / # 0
'
-
1 for
for (initialization;LoopContinuationTest; increment )
statement
0 ' /
1
# int counter; for(counter=1; counter<= 10; counter++) Printf(“%d \n”, counter);
()
'
No semicolon after last statement
0 ' / • For
1 -
while
initialization; while ( loopContinuationTest){ statement increment; }
0 ' / #
2
1 &
int I; for(i=0, j=0; j+i <= 10; j++, i++) printf(“%d \n”, j + i);
' 1 • Program to sum the even numbers from 2 to 100 3
4
5
$% 6 7 , 8 ' $ 798 47 8 7 : 8 ' $; 1 < = , %8 >
Sum is 2550
7
: 9%
/ 3
4
5
$% 6 ,8 $%8 ' $ 7 8 4?8 ::%6 ' $ 7 8 4@8 ::% ' $A BA %8 ' $A C A %8 > >
) # *
. ' ,'
?, ' , Enter number of sides: 5 * ** * * * * *****
' D-
'
) # *
. ' ,'
?, ' , Enter number of sides: 5 ***** * * * * ** *
' D-
'