int factorial(int x){ if (x <= 0) return 1; else return (x*factorial(x - 1)); } int _tmain(int argc, _TCHAR* argv[]) { std::cout << "Please enter your number :::"; int x; std::cin >> x; std::cout<<"factorial(" << x << ") = "<< factorial(x); getchar(); getchar(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)