Use int value as while loop counter - C++ Statement

C++ examples for Statement:while

Description

Use int value as while loop counter

Demo Code

#include <iostream>
using namespace std;
int main()//from  ww  w.j a va  2 s . c  o  m
{
   int count;
   count = 1;            // initialize count
   while (count <= 10)
   {
      cout << count << "  ";
      count++;            // increment count
   }
   return 0;
}

Result


Related Tutorials