[ create a new paste ] login | about

Link: http://codepad.org/9ZHhjahj    [ raw code | output | fork ]

C++, pasted on Jan 22:
#include <iostream>
#include <cmath>
 
using namespace std;
 
 
int main()
{
    cout.flush();
 
    int sum = 0, total = 0;
 
    for (int i=1; i<=10; i++)
    {
        sum = static_cast<int>(pow(static_cast<double>(i), 2));
        total += sum;
    }
 
    cout<<"Sum = " <<total;
    cin.get();
 
    return 0;
}


Output:
1
Sum = 385


Create a new paste based on this one


Comments: