fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int i,n,j=0;
  7. cin>>n;
  8. for(i=n;i>=1;i--){
  9. j=j+(i*i);
  10. }
  11. cout<<j;
  12. return 0;
  13. }
Success #stdin #stdout 0.01s 5320KB
stdin
5
stdout
55