Get to know do-while loops - C++ Statement

C++ examples for Statement:do while

Introduction

The general syntax of a do-while loop is

do { 
   <statements>; 
} while (<expression>); 

Demo Code

#include <iostream> 
#include <cmath> 
using namespace std ; 

int main(){//from ww  w .j  ava  2s.c  o m
   int count = 10; 
   do { 
       cout << count ; 
       cout << "\n"; 
       count --; 
   } while ( count >= 1); 
   cout << " Blast off !\n"; 
   return 0;
} 

Result


Related Tutorials