C++ for statement Count and sum

Description

C++ for statement Count and sum

#include <iostream> 

using namespace std; 

int main() /*  w  ww. j a  v a2s  . c  o m*/
{ 
    int x = 0; 
    int i; 

    for (i = 1; i <= 100; i++) 
    { 
       x += i; 
    } 

    cout << x << endl; 
    return 0; 
}



PreviousNext

Related