///G. Hagopian
///Use Horner's method to evaluate a polynomial

#include <iostream>
#include <vector>
using namespace std;

double cube(double x) {
    return x*x*x;
}

double formula(double x) {
    x = x*(x+1)/2;
    return x*x;
}

int main() {
    double n; ///number of terms
    ///1^3+2^3+3^3+...+n^3
    cout << "\nEnter a positive integer: ";
    while(cin >> n) {
        double sum = 0; ///accumulator
        for(double i = 1; i <= n; i++)
            sum += cube(i);
        cout << "\nIt is true that " << formula(n) << "==" << sum;
        cout << "\nEnter a positive integer: ";
    }


}
