Please let me know what is wrong with this

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

I have gone through the big computation tutorial and is obviously a good choice but still why wrong answer with this?

#include <stdio.h>

#include <math.h>

#include <string.h>

#define LL long long

#define ULL unsigned long long

#define max(a,b) a>b?a:b;

#define min(a,b) a<b?a:b;

#define fr(i,a) for(i = 0; i < a; i++)

#define fre(i,a) for(i = 1; i <= a; i++)

#define si(a) scanf("%d",&a)

#define sd(a) scanf("%lf",&a)

#define sl(a) scanf("%Ld",&a)

#define ss(a) scanf("%s",a)

LL gcd(LL a, LL b){

if (b == 0) return a;

else return gcd(b,a % b);

}

LL lcm(LL a,LL b){

return (a * b)/ gcd(a,b);

}

LL a[109];

double fact(double n) {

int x = n;

if(a[x]) return a[x];

else return n*fact(n-1);

}

int main() {

int t;

si(t);

while(t–) {

int n;

double ans;

si(n);

a[0] = a[1] = 1;

ans = fact(n);

printf("%.0lf\n", ans);

}

}