#include<stdio.h>
int main(void){
int t,n,fact;
scanf("%d",&t);
for(int i=0; i<t; i++){
scanf("%d",&n);
fact=1;
for(int i=n; i>0; i--){
fact=fact*i;
}
printf("%d\n",fact);
}
}
#include<stdio.h>
int main(void){
int t,n,fact;
scanf("%d",&t);
for(int i=0; i<t; i++){
scanf("%d",&n);
fact=1;
for(int i=n; i>0; i--){
fact=fact*i;
}
printf("%d\n",fact);
}
}
Factorial 100 is approximately equal to 9.33\times 10^{157}. This large value cannot be stored in 32-bit integer variable.
Check the following solution.