#include <stdio.h>
int fact();
int main(void) {
int tc;
scanf("%d",&tc);
int a[tc];
int res[tc];
int i = 0;
for(i = 0 ; i < tc ; i ++){
scanf("%d",&a[i]);
res[i] = fact(a[i]);
}
for(i = 0 ; i < tc ; i ++){
printf("%d\n",res[i]);
}
return 0;
}
int fact(int n){
if(n == 1){
return 1;
}else
return n * fact(n - 1);
}
insert parameter when initialized . change this int fact();
into this int fact(int n);
Bro its still not working!!!
i think its IDE Problem
Input / Output
Output is correct but not accepted by Code Chef IDE
4
2
3
4
5
2
6
24
120
share the link to the problem . i could help you
The problem is that if the input exceeds 20 , then no primitive datatype can store the value and represent it , u can use python as it can handle large values or refer this tutorial by codechef : Tutorial for Small Factories to do it using primitive datatype in c.