Demonstrate simple FOR loop - C++ Statement

C++ examples for Statement:for

Description

Demonstrate simple FOR loop

Demo Code

#include <iostream>
using namespace std;
int main()//from w  w w  .j  a va  2s  .  c  o m
{
   int j;                     //define a loop variable
   for(j=0; j<15; j++)        //loop from 0 to 14,
      cout << j * j << "  ";  //displaying the square of j
   cout << endl;
   return 0;
}

Result


Related Tutorials