Computer Science, asked by riyabajpayee01, 1 year ago

Do while....loop checks the condition on

Answers

Answered by satishatbcdp9vp8p
1
Contrast with the while loop, which tests the condition before the code within the block is executed, the do-while loop is an exit-condition loop. This means that the code must always be executed first and then the expression or test condition is evaluated. If it is true, the code executes the body of the loop again.
Answered by dikshaagarwal4442
0

Answer:

Do while loop checks the condition at the end of the loop. So, the statement inside the loop will run at least one time.

Explanation:

You will recall that the for and while loop types check for the loop condition at the beginning of the loop if you are familiar with how they operate. The loop will not be run if the condition is not met.

The do-while loop verifies the outcome of the condition at its conclusion. This implies that even if the condition is never true, the statements inside the loop body will be carried out at least once.

do{

 // statement

 // increment / decrement

} while(condition)

If the condition is met, the control is returned to the loop's start. The control exits the loop if the condition is false. This indicates that before the condition is tested, the statements included within the loop are carried out. Therefore, if the loop body has to be run at least once, the do-while loop should be employed. In menu-driven programs, a do-while loop is frequently required to determine which action the user intends to take when repeated actions are to be performed depending on user input. The control exits the loop in these circumstances when the user input corresponds to an exit command.

To know more about the for loop, click on the link below:

https://brainly.in/question/33475982

To know more about the while loop, click on the link below:

https://brainly.in/question/30100527

#SPJ6

Similar questions