The while statement is also a looping statement. The while
loop evaluates the test expression before every loop, so it can execute zero
times if the condition is initially false. It has the following syntax.
Here the initialization of a loop control variable is
generally done before the loop separately. The testing of the condition is done
in while by evaluating the expression within the parenthesis. If the evaluation
result is true value, the block of statement within calibrates is executed. If
the evaluation result is false value the block of statements within the body of
loop is skipped and the loop execution get terminated with the control passing
to the statement immediately following the while construct. The increment or
decrement of the loop control variable is generally done within the body of the
The following example illustrates the use of while loop.