This is a function I made to calculate the factorial of a number
#include <iostream>
using namespace std;
int fact(int n) {
if (n < 0) {
cout << "Negative values not allowed";
exit(4);
}
if (n == 0 || n == 1)
return 1;
else
return n * fact(n - 1);
}
Now for some reason this code gives me correct answers up to x=12 (I used wolfram to check) after that it gives me wrong answers which is very strange why is that ?