The do..... while loop in C++

The do.... while loop checks its condition at the bottom of the loop.
A do.... while loop is similar to a while loop. The one difference is that the do.... while loop is guaranteed to execute at least one time.
Syntax:

do
{
statement(s);
}while(condition);

Example:

int a=0;
do
{
cout<<a<<endl;
a++
}while(a<10);

Output:

0
1
2
3
4
5
6
7
8
9


Related Article