The while loop:
The
simplest among all the looping structures in C is the while statement. The
basic format of while statement is:
initialization;
while ( test condition )
{
body of loop
increment/decrement;
}
First
test – condition is evaluated and if the condition is true, then the body of
the loop is executed. After execution of the body, the test – condition is once
again evaluated and if it is true, the body is executed once again. This
process of repeated execution of the body continues until the test – condition
finally becomes false and the control is transferred out of the loop. On exit,
the program continues with the statement immediately after the body of the
loop.
Post a Comment