State any two differences between while and do-while statement.
while
|
Do-while
|
In 'while' loop the controlling condition appears at the start of the loop.
|
In 'do-while' loop the controlling condition appears at the end of the loop.
|
The iterations do not occur if, the condition at the first iteration, appears false.
|
The iteration occurs at least once even if the condition is false at the first iteration.
|
It is an entry controlled loop
|
It is an exit controlled loop
|
while(condition) { body }
|
do { body }while(condition);
|