Skip to content

Instantly share code, notes, and snippets.

@CodeMaster7000
Created January 29, 2022 09:47
Show Gist options
  • Select an option

  • Save CodeMaster7000/0e62cf34535c268802b40b71b1bc14d4 to your computer and use it in GitHub Desktop.

Select an option

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.
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