Need help with FCTRL2 using C++

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.

using namespace std;

double factorial (int n);

int main () {
int t;
cin >> t;

for (int i=0 ; i<t ; i++) {
	int n;
	cin >> n;

return 0;


double factorial (int n) {
if (n==1) return 1;
else {
return n*factorial(n-1);