Skip to content

Instantly share code, notes, and snippets.

@bhaveshmunot1
Created June 3, 2020 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhaveshmunot1/4a3e7523a657e8a0951c86d9246b5a69 to your computer and use it in GitHub Desktop.
Save bhaveshmunot1/4a3e7523a657e8a0951c86d9246b5a69 to your computer and use it in GitHub Desktop.
Factorial of 3 using recursion.
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