(PCC)::[How-to-write-CPP-program-to-Calculate-Factorial-of-a-Number-Using-Recursion]::[cpp]
//Example: Calculate Factorial Using Recursion #include<iostream> using namespace std; int factorial(int n); int main() { int n; cout << "Enter a positive integer: "; cin >> n; cout << "Factorial of " << n << " = " << factorial(n); return 0; } int factorial(int n) { if(n > 1) return n * factorial(n - 1); else return 1; }