Below is my code for the FCTRL2 problem,i have seen that it works correctly for all the inputs,i am not sure for what reason i am getting wrong answer and my answer is not being accepted.
Can anyone help? thanks.
#include <stdio.h>
int main()
{
int t;
scanf("%d",&t);
while (t--) {
int n,x=0,i,j,temp=0,a[200],k;
scanf("%d",&n);
int m=1;
a[0]=1;
for (i=1; i<=n; i++) {
for (j=0; j<m; j++) {
x=a[j]*i+temp;
a[j]=x%10;
temp=x/10;
}
while (temp>0) {
a[m]=temp%10;
temp=temp/10;
m++;
}
}
for (k=m-1; k>=0; k--) {
printf("%d",a[k]);
}
}
}