Skip to content

Instantly share code, notes, and snippets.

@shohan4556
Created February 14, 2015 02:50
Show Gist options
  • Select an option

  • Save shohan4556/08ca00053b7123926f6e to your computer and use it in GitHub Desktop.

Select an option

Save shohan4556/08ca00053b7123926f6e to your computer and use it in GitHub Desktop.
URI 1323 solution
/// Author : Shohan
/// URI 1323
/// Problem level : Easy
#include<stdio.h>
int main()
{
int ans,n,t;
while(scanf("%d",&n)==1){
if(n==0)
break;
ans=(n*(n+1)) * (2*n+1);
t=ans/6;
printf("%d\n",t);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment