#include<iostream>
#include<fstream>
#include<cmath>
#include<iomanip>
using namespace std;
unsigned __int64 Fact(unsigned __int64 x );
int main(){
/*n! means n (n 1) ... 3 2 1
Find the sum of the digits in the number 100!*/
cout<<Fact(100);
}
unsigned __int64 Fact(unsigned __int64 x )
{
__int64 num(0);
if(x==0)
return 1;
else
{
num = x * Fact(x-1);
cout<<num<<" "<<x<<endl;
}
return num;
}
my recursive function works. But only for small x. (ex. 5! =120).
but when i try (100!) it runs out of space and give NULL;
so can you hint on how i can fix the code so that the computer will compute 100factorial?