Demonstrates the for loop in its final form - C++ Statement

C++ examples for Statement:for

Description

Demonstrates the for loop in its final form

Demo Code

#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; 
}

Result


Related Tutorials