Q.Draw flowchart for checking whether given number is even or odd.
Q.State any two differences between while and do-while statement.
(Note: Any 2 points shall be considered).
while Do-while
In 'while' loop the controlling In 'do-while' loop
condition appears at the start of the controlling
the loop. condition appears at
the end of the loop.
The iterations do not occur if, The iteration occurs at
the condition at the first least
iteration, appears false. 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) Do
{ {
Body Body
} )while( );
Q.State any two differences between while and do-while statement.
(Note: Any 2 points shall be considered).
while Do-while
In 'while' loop the controlling In 'do-while' loop
condition appears at the start of the controlling
the loop. condition appears at
the end of the loop.
The iterations do not occur if, The iteration occurs at
the condition at the first least
iteration, appears false. 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) Do
{ {
Body Body
} )while( );