Pafnytiu

сумма 1 - 1

Nov 8th, 2015
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. #include<iostream>
  2. #include<cmath>
  3. using namespace std;
  4. int main()
  5. {
  6. float n, s=0;
  7.         cin >> n;
  8.         for (int i = 1; i <= n; i++)
  9.                 s += pow(i,2);
  10.         cout << s << endl;
  11.         system("pause");
  12.         return 0;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment