Wrong Answer Error.
My Code #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
for(int i=0;i<t;i++)
{ int A;
cin>>A;
long long int fact=1;
for(int i=A;i>0;i–)
{
fact=fact*i;
}
cout<<fact<<endl;
}
return 0;
}
I have tested on different numbers. it’s showing right answer but when i’m trying to submit my answer then it throwing wrong answer error.
please ! can you help me to identifying my mistakes.
An integer t, 1<=t<=100, denoting the number of testcases, followed by t lines, each containing a single integer n, 1<=n<=100.
As per the given constraints, if an input value is 100 then the factorial value will be so large that even long long int data type won’t be able to store it.
You can go through this discussion to understand how to deal with it: