
Loop Control 207
Inner Loop (k) Completed.
Middle Loop (j) Completed.
Outer Loop (i) Completed.
do
{
statement/s;
}
while(condition);
Explanation:
In the above program, variables i, j and k are declared and initialized to 1. The inner most loop
is ‘k’, the middle is ‘j’ and the outer most is ‘i’. The execution of loop starts from outer to
inner and the completion will be from inner most to the outer most. Here, for example, the values
of i, j and k are printed and messages are printed to understand the termination of loops.
6.5 THE do-while LOOP
The syntax of do-while loop in C is as follows.
The difference between the while and do-while loop ...