Advertisement
guiguicadillac

recursive factorial

Apr 28th, 2020
733
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 0.10 KB | None | 0 0
  1. fact <- function (n) {
  2.     if (n <= 1)
  3.         1
  4.     else
  5.         n * fact(n-1)
  6. }
  7. print(fact(5))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement