The do-while Loop in C++ :

while loop:

C language do-while Loop - The do-while loop is an exit control, it evaluates its test-expression at the bottom of the loop after executing its loop-body statements. The general syntax of the do-while loop is:

do
{
statement;
}
while(test-expression)


Example :

  1. /* Description: Print 1 to 10 use do-while loop in C++ language */
  2. #include<iostream>
  3. using namespace std;
  4. int main()
  5. {
  6. int i=1;
  7. do
  8. {
  9. cout << "\n do-while loop : " <<i ;
  10. i++;
  11. } while( i <= 10 );
  12. }

Output :

C++ language Print 1 to 10 use do-while loop

Next Update

Loading...

Friend's some reason we need some long time for next update, Sorry For Long Time, see you soon.

We make a Collaboration with HackIsOn YouTube Channel So, Please Subscribe Their Channel and keep supporting