Advertisement
noshin98

uva 12149

Jul 5th, 2016
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.29 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int n,i,sum;
  5.     while(scanf("%d",&n)==1)
  6.     {
  7.         if(n==0)
  8.             break;
  9.             sum=0;
  10.         for(i=1;i<=n;i++)
  11.         {
  12.             sum=sum+i*i;
  13.             sum=sum;
  14.         }
  15.         printf("%d\n",sum);
  16.     }
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement