Code is working but I can not understand how Result ith value is generating??? Please help I had to spend 1day long. Please help.
#include<stdio.h>
int main()
{
int t;
scanf("%d", &t);
while(t–)
{
int n;
scanf("%d", &n);
int a[1000], m=1, temp = 0, i ,j,x;
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[j++] = temp %10;
temp = temp/10;
m++;
}
}
for(i=m-1; i>=0; i--)
{
printf("%d",a[i]);
}
printf("\n");
}
}