long int factor( int num ) {
if (num == 1) {
return (1);
}
else
return num * factor (num - 1);
}
int main(int argc, const char * argv[]) {
long int fact;
int num;
std::string num_as_string;
std::cout << "\n Enter an integer to take the factorial of:\n ";
std::cin >> num_as_string;
num = stoi(num_as_string);
fact = factor(num);
std::cout << num << "! is " << fact << "\n";
return 0;
}