//Code for calculating the factorial of numbers
#include
using namespace std;
int main()
{
//Enter the number of test cases
int t;
cin >> t;
int arr[t]{0};
for(int i=0;i<t;i++)
{
//Enter the value of numbers.
int n;
cin >> n;
int j=n;
int s=1;
//Computing the value of their factorials
while(j!=0)
{
s=s*j;
j–;
}
arr[i]=s;
}
cout <<"--------------------------------------"<<endl;
//Printing the result.
for(int j=0;j<t;j++)
{
cout << arr[j] <<endl;
}
return 0;
}
It shows correct answer using custom input but shows “Wrong Ans” While submitting the solution.