Get to know while loops - C++ Statement

C++ examples for Statement:while

Introduction

The general syntax of a while loop is.

while  (<expression>)   { 
   <statements> 
} 

Demo Code

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

int main(){/*from   www. j a  v  a  2s.  c om*/
   int count = 10; 
   while ( count >0) { 
       cout << count ; 
       cout << "\n"; 
       count --; 
   } 
   cout << " Blast off !\n"; 
   return 0;
}

Result


Related Tutorials