fordemo.cpp


// fordemo.cpp
// demonstrates simple FOR loop
#include <iostream>
using namespace std;

int main()
{
	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;
}


Results

C:\classes\ece538\work>fordemo
0  1  4  9  16  25  36  49  64  81  100  121  144  169  196


Maintained by John Loomis, updated Mon Jan 01 12:50:04 2007