Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. def recursion_factorial(n):
  2.    if n == 1:
  3.        return n
  4.    else:
  5.        return n*recursion_factorial(n-1)
  6.  
  7. find_factorial = 5
  8.  
  9. if find_factorial < 0:
  10.    print("Sorry, factorial does not exist for negative numbers")
  11. elif find_factorial == 0:
  12.    print("The factorial of 0 is 1")
  13. else:
  14.    print("The factorial of", find_factorial, "is", recursion_factorial(find_factorial))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement