How to program to find a factorial of a number using recursion in python


How to program to find a factorial of a number using recursion in python.


  1. def factorial_recursive(n):
     if n == 1:
     return 1
     else:
     return n * factorial_recursive(n-1)
    num=int(input("Enter a number to find factorial"))
    f=factorial_recursive(n)

    print(f)

OutPut:-

Post a Comment

0 Comments