A do-while loop is useful when we want that the statements within the loop must be executed
a) only once
b) at least once
c) more than once
d) none of these
Answers
Answered by
11
Answer:
b
Explanation:
in case the condition is true,the control goes back to beginning of loop.. this means that the statements inside the loop are executed before the condition is tested.so do while loop should be used in all scenarios where the loop body needs to be executed at least once.
Answered by
0
When the do while loop is used the statements written inside the block of do must be executed once at least . Hence, the correct option is 'b'.
How do-while loop works:
- The statements written inside the body of do block is executed at least once, before the given condition is checked in while part of the loop.
- In do while loop the flow of control of the program reached the condition written inside the while loop only after passing from the body of the do block.
Syntax for do while loop:
do {
//inside the do block
statement( );
}
while( condition );
Answered by
0
When the do while loop is used the statements written inside the block of do must be executed once at least . Hence, the correct option is 'b'.
How do-while loop works:
- The statements written inside the body of do block is executed at least once, before the given condition is checked in while part of the loop.
- In do while loop the flow of control of the program reached the condition written inside the while loop only after passing from the body of the do block.
Syntax for do while loop:
do {
//inside the do block
statement( );
}
while( condition );
Similar questions