csansoon

P6.07 P36668 Sum of squares

Nov 7th, 2018
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.13 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int n,r=0;
  6.     cin>>n;
  7.     for (n;n>0;n--) r=r+(n*n);
  8.     cout<<r<<endl;
  9. }
Advertisement
Add Comment
Please, Sign In to add comment