Created
January 29, 2022 09:47
-
-
Save CodeMaster7000/0e62cf34535c268802b40b71b1bc14d4 to your computer and use it in GitHub Desktop.
A program in R to find the factorial of a number using recursion.
This file contains hidden or 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
| recur_factorial <- function(n) { | |
| if(n <= 1) { | |
| return(1) | |
| } else { | |
| return(n * recur_factorial(n-1)) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment