While Loop

While Loop


The while loop is entry controlled loop. The while loop keeps on executing the block of statement till the specified test condition evaluates to true. When the test condition becomes false, the program control is transferred out of the loop and passes to the statement after the body of the loop.

Syntax:

while(condition)
{
Statement 1;
Statement 2;
…………..
Statement n;
}