- Python program to find factorial of a number using recursion in python.
- Algorithm to find factorial of a number using recursion function using python.
#1: Python program to find factorial of a given number using recursion
- #Factorial using recursion
- def fact(n):
- if n==1:
- return 1
- else:
- return n*fact(n-1)
- n=int(input("Enter the number: "))
- result=fact(n)
- print("Factorial of",n,"is", result)
Output:
- Enter the number: 6
- Factorial of 6 is 720