Small factorial

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");

}

}

first of all your while loop is not correct it should be while(t–) instead of while(t-).

@admin @vijju123 You should inform the developers about this bug(or is it a feature?) that every time “dash dash” is replaced by a single “dash”…

__
_
\hspace{0mm} \hspace{0mm}