3410. Feynman Problem code: SAMER08F
#include<stdio.h>
int main()
{
int n;
while(1)
{
scanf("%d",&n);
if(n==0)
break;
printf("%d\n", (n*(n+1)*(2*n+1))/6 );
}
return 0;
}
#include<stdio.h>
int main()
{
int n;
while(1)
{
scanf("%d",&n);
if(n==0)
break;
printf("%d\n", (n*(n+1)*(2*n+1))/6 );
}
return 0;
}
No comments:
Post a Comment