Syntax:
do
{
statements;
.
.
}
while(condition);
Example program
//To print natural numbers from 1 – 10
#include<iostream.h>
#include<conio.h>
void main()
{
int i=1;
do
{
cout<<i<<endl;
i++;
}
while(i<=10);
getch();
}
Output:
1
2
3
4
5
6
7
8
9
10
See also: While loop in C++
Not Satisfied ? Just search & get the result
Related posts:
