small factorial (Why wrong?)

#include<stdio.h>
long long int fact(int n);
int main()
{
int n,i,k[i];
long int d[i];
scanf("%d",&n);
for(i=0;i<n;i++)
{
if(1<=n<=100 && 1<=k<=100)
scanf("%d",&k[i]);
}
for(i=0;i<n;i++)
{
d[i]=fact(k[i]);
printf("%lld\n",d[i]);
}
return 0;
}
long long int fact(int n)
{
if(n>=1)
return(n*fact(n-1));
else
return 1;
}

https://www.codechef.com/viewsolution/13353189

Check this. I hope you understand.

If you want to solve it using recursion. Have a look at:
https://www.codechef.com/viewsolution/15220161