Demonstrate WHILE loop - C++ Statement

C++ examples for Statement:while

Description

Demonstrate WHILE loop

Demo Code

#include <iostream>
using namespace std;
int main()/*w ww  . jav  a2  s. c o  m*/
{
   int n = 99;       // make sure n isn't initialized to 0
   while( n != 0 )   // loop until n is 0
      cin >> n;      // read a number into n
   cout << endl;
   return 0;
}

Result


Related Tutorials