# How to write a code to find the factorial of 100?

As the output will contain 150 digits and even long int can’t store these many digits. So how can I solve this problem?

Usually this problem gets resolved by printing the answer in modulo X. Meaning, usually, you don’t need to store 150 digits.

But if you really had to print 150 digits, then it depends on the language you use. Java has BigInteger for that. The closest I found for c++ were the external GNU Multiple Precision Arithmetic Library and the InfInt Library.

Here is the link to the actual question.

this problem is definitely harder than the suggested rating (648). Probably because it has a nice tutorial that makes the problem easy again: Tutorial for Small Factories

#include<stdio.h>

int main()
{
int t,n,a[200],i,j,k,l,m;
scanf("%d",&t);
while(t–)
{
scanf("%d",&n);
m=1;
a[0]=1;
for(j=2;j<=n;j++)
{
l=0;
for(k=0;k<m;k++)
{
a[k]=a[k]*j+l;
l=a[k]/10;
a[k]=a[k]%10;
}
while(l)
{
a[k]=l%10;
k++;
m++;
l=l/10;
}
}
for(i=m-1;i>=0;i–)
printf("%d",a[i]);

``````    printf("\n");
}
return 0;
``````

}