Created
June 3, 2020 09:28
-
-
Save bhaveshmunot1/4a3e7523a657e8a0951c86d9246b5a69 to your computer and use it in GitHub Desktop.
Factorial of 3 using recursion.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int factorial(int n) { | |
if (n == 1) { | |
return 1; | |
} | |
int fact_n_1 = factorial(n-1); | |
return n * fact_n_1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment