C++ Do/While Loop

C++ Do/While Loop


C++ Do/While Loop :

The do/while loop is a variant of the while loop with one but there is one of the major difference is the body of do/while loop is executed once before the condition is checked. Then it will repeat the loop as long as the condition is true.

The Syntax of do/while loop is as follows:

Initialization

do {

      // loop Statements;

      Update;

} while (condition);

Example :

Output :