DEV Community

saurabh belote
saurabh belote

Posted on

find factorial with recursion

def factorial(n):
  if n <= 1:
    return 1
  else:
    return n * (factorial(n - 1))

print(factorial(21))

Enter fullscreen mode Exit fullscreen mode

Top comments (0)