small factorial problem

code works for my compiler… for 100 as well

#include<stdio.h>
int main()
{
	int a[200],m,n,i,j,k,c,x,l,temp;
	
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{    x=0;
	     m=1;
	     a[0]=1;
	     temp=0;
		scanf("%d",&c);
		if(c==1){ printf("%d\n",c); break;}
		for(j=1;j<=c;j++)
		{
			for(k=0;k<m;k++)
			{
				x=j*a[k]+temp;
				a[k]=x%10;
				temp=x/10;}
				while(temp!=0)
				{
					temp=temp%10;
					a[m]=temp;
					m++;
					temp=temp/10;
				}
			
		}
		for(l=m-1;l>=0;l--)
		printf("%d",a[l]);
		printf("\n");
	}
	return 0;
}

I’ll give you two inputs, for which your program fails (15! == 1307674368000). Try debugging it on them.

2
1
1

and

1
100
1 Like

thank u so much…