Leave the for loop incremental part empty - C++ Statement

C++ examples for Statement:for

Description

Leave the for loop incremental part empty

Demo Code

#include <iostream>
using namespace std;
int main()/*w ww. j  a v  a2  s . com*/
{
   int count;
   count = 2;    // initializer outside the for loop
   for ( ; count <= 20; )
   {
      cout << count << "  ";
      count = count + 2;    // altering statement
   }
   return 0;
}

Result


Related Tutorials