i used the code below… but i could not store the value of the large integer generated… what to do ? i have marked the error in form of comments…
#include<stdio.h>
int fact(int x)
{
int f;
if(x==1)
return 1;
else
f=x*fact(x-1);
return f;
}
main()
{
int t,n,i;
long long int y;
scanf("%d",&t);
if(t>=1&&t<=10000)
{
for(i=0;i<t;i++)
{
scanf("%d",&n);
if(n>=1&&n<=10000)
{
if(n==1)
{
printf("0\n");
}
else if(n==2)
{
printf("4\n");
}
else if(n==3)
{
printf("42\n");
}
else if(n==4)
{
printf("240\n");
}
else
{
y=(fact(n)/(fact(4)*fact(n-4)))*240+(fact(n)/(fact(3)*fact(n-3)))*42+(fact(n)/(fact(2)*fact(n-2)))*4;
printf("%lld\n",y); // error is here..!!
}
}
}
}
return 0;
}