#include<stdio.h>
long int k;
void fact(long int  a[],long int n)
{
    long int c=0,temp,i=0;
    while(i<=k)
    {
        temp=a[i]*n+c;
        a[i]=temp%10;
        c=temp/10;
        i++;
    }
    while(c!=0)
    {
        a[i]=c%10;
        c=c/10;
        k++;
        i++;
    }
}

main()
{
    long int t,i,n,a[200];
    scanf("%ld",&t);
    while(t)
    {
        scanf("%ld",&n);
        k=0;
        i=2;
        a[0]=1;
        for(i=2;i<=n;i++)
        {
            fact(a,i);
        }
        for(i=k;i>=0;i--)
        {
            printf("%ld",a[i]);
        }
        printf("\n");
        t--;
    }
    return 0;
}

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to