#include using namespace std;
int fac(int x) { int ans = 1,j; for(j=1;j<=x;j++) { ans = ans * j; } cout << ans << endl; } int main() { int i,n,temp; cin >> n; int t[n]; for (i=1;i<=n;i++) { cin >>t[i]; temp = t[i]; fac(temp); } return 0; }
The value of variable ans in your will exceed INT_MAX and hence your codes gives WA. INT data type cannot hold values as big as 100!.
You could search for alternative ways to solve the problem in C/C++ or use languages like Python.
Oh I don’t know, how about YOU TELL ME?