C++ examples for Statement:for
Demonstrates the for loop in its final form
#include <iostream> using namespace std; int main() /*from w w w. j ava2 s . co m*/ { int x = 0; int i; for (i = 1; i <= 100; i++) { x += i; } cout << x << endl; return 0; }