Problem Code: FCTRL2

#include<stdio.h>

int main()
{
int t,i,j,n[100];
long f=1;
scanf("%d",&t);

 for (j=0;j<t;j++)

{ scanf("%d",&n[j]);
}
for(i=1;i<=n[j];i++)
{ f*=i;

printf("%d",f);

}

return 0;
}

Whats Wrong With this ?I am getting time limit exceeded Error

maximum time for problem is 0.23 ms and your program runs more than the allocated time.
and analyse the constraints properly input can be <= 100. if input is 100 and 100! is of 158 digits none of the c data type supports 158 digits.

1 Like

You have to use an array to output such a huge number.even long long int has a range of 10^18.