| 5 | using namespace std; |
| 6 | |
| 7 | long long int factorial(int n) { //Base Case |
| 8 | |
| 9 | if (n==0 || n==1){ |
| 10 | return 1; |
| 11 | } |
| 12 | |
| 13 | else{ |
| 14 | //return n * factorial(n-1) one way |
| 15 | //other way |
| 16 | |
| 17 | int recResult = factorial(n-1); // Recursive Call |
| 18 | int result = n*recResult; // Small Calculation |
| 19 | return result; |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | int main(){ |
| 24 |