#include
using namespace std;
int main()
{
double t,fact=1,i,n;
cin>>t;
if(t>=1&&t<=100)
{
while(t!=0)
{
cin>>n;
if(n>=1&&n<=100)
{
if(n==1)
cout<<n;
else
{
for(i=1;i<=n;i++)
{
fact=fact*i;
}
cout<<fact<<"\n";
}
fact=1;
t–;
}
else
break;
}
}
return 0;
}
Read the problem statement again. The value of 1<=n<=100. Your code will fail on numbers greater than 20 because after it the result(factorial in this case) will become too large and no datatype in C/C++ can handle numbers greater than 10^{18}.
Solution :

Try using a character array for such problems where the results are too large,

Or use languages like python, java where you have inbuilt BigInteger library to handle such large numbers.