0 like 0 dislike
1 view
asked in Computer Science by (383k points)
Write the syntax of do-while loop.

1 Answer

0 like 0 dislike
answered by (383k points)
Unlike for and while loops, which test the loop condition at the top of the loop, the do...while loop in C programming checks its condition at the bottom of the loop.

A do...while loop is similar to a while loop, except the fact that it is guaranteed to execute at least one time.


The syntax of a do...while loop in C programming language is −

Notice that the conditional expression appears at the end of the loop, so the statement(s) in the loop executes once before the condition is tested.

If the condition is true, the flow of control jumps back up to do, and the statement(s) in the loop executes again. This process repeats until the given condition becomes false.
Welcome to Free Homework Help, where you can ask questions and receive answers from other members of the community. Anybody can ask a question. Anybody can answer. The best answers are voted up and rise to the top. Join them; it only takes a minute:

8.6k questions

7.7k answers


3.2k users


Free Hit Counters