Here is my code for the given problem. I am getting the correct answer when I try to compile and run it in my computer, but when I submit the exact code, it shows Wrong Answer. Help me identify my mistake.
#include
using namespace std;
double factorial (int n);
int main () {
int t;
cin >> t;
for (int i=0 ; i<t ; i++) {
int n;
cin >> n;
printf("%.0f\n",factorial(n));
}
return 0;
}
double factorial (int n) {
if (n==1) return 1;
else {
return n*factorial(n-1);
}
}