1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include <iostream> int factorial(int target) { if (target==1) return 1; else return (target * factorial(target-1)); } int main(){ int result; std::cin >> result; std::cout << factorial(result); return 0; } |
Direct link: https://paste.plurk.com/show/2321900