View Code of Problem 30

#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;
int main( )
{
    int n;
    int a=0;

    while(cin >> n)
    {
        for(int i=0;i<=n;i++)
        {
            a=a+i;
        }
        cout << a<< endl;
    }

    return 0;
}

Double click to view unformatted code.


Back to problem 30