- 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
You Might like :
- Python try except else with example program
- Python finally block example with program
- Python try-except- else vs finally with example program
- Find factorial of a number without using recursion using python
- Python program to find factorial without recursion
- If statement in python example program
- Else statement in python with example program
- Types of operators in python
- python math operators
- python division operator
- Python modulo operator
- Python bitwise operators
- python comparison operators
- Logical operators in python
- Assignment operator in python
- Identity operator in python
- Python power operator
- Not equal operator in python
- python not operator
- python and operator
- python Ternary operator
- python string operations
- python string methods
- Spilt function in python
- Format function in python
- String reverse in python
- python tolower
- Remove spaces from string python
- Replace function in python
- Strip function in python
- Length of string python
- Concat python
- startswith python
- strftime python
- is numeric python
- is alpha python
- is digit python
- python substring
No comments