How we can use simple do while loop in c++ code


In do while loop, the ststement will execute one time first and then check the condition. One statement will execute in every condition.

Code:


#include <iostream>
#include <string>
using namespace std;
int main() {
                int i;
                i=0;
                do
                {
                                cout<<i<<endl;
                                i++;
                }
                while(i<=9);
}

Output:


0
1
2
3
4
5
6
7
8
9
Hop you understand the use of do while loop in c++.


Click here for watching the video of that code


avatar
AUTHOR: Muhammad Abbas
I am Software Engineer.

0 Comments