There is another loop control structure which is very similar to the while statement, called as the Do While Loop in C Language. The only difference is that the expression which determines whether to carry on looping is evaluated at the end of each loop.
The syntax for Do while Loop in C Language
In the do-while loop, the body of the loop is executed at least once before the condition is evaluated. Then the loop repeats body as long as the condition is true. However, in while loop, the statement doesn’t execute the body of the loop even once, if the condition is false. That is why the do-while loop is also called exit-control loop.
Program to illustrate Do while Loop in C Language
Write a program to print first ten even natural numbers.
/* Program to print first ten even natural numbers */
i=i+1; } while (i<10);
2 4 6 8 10 12 14 16 18 20