https://www.codechef.com/problems/FCTRL2 -- Code not working

i just dont know why i cant output the right factorials… even though the code works fine…the compiler always shows wrong solution…
Also i saw solutions that others have posted and they have used a multiprecision header file…what is that and why is it needed…
#include
using namespace std;
int main()
{
int t,n;
cin>>t;
while(t–)
{
int fact=1;
cin>>n;
if(n==0)
fact=1;
else
{
for(int i=n;i>0;i–)
fact=fact*i;
}
cout<<fact<<endl;
}
}

1 Like

okay …i ll do that henceforth…thanks

1 Like

bro it should be while(t–>0) … there is no termination in ur while loop and it should be i– in for loop …

put - -

Also, please either format your code or (better!) link to your submission, so we don’t get posts like the other three in this thread :slight_smile: