Factorial Program in Python using Recursion

Python program to find the factorial of a number using recursion.

Factorial Program in Python using Recursion: In this article, we will learn a Python program to find the factorial of a number using recursion technique.

A Factorial of a number is the product of all whole number less that or equal to N

The Factorial of a number N is denoted by N!.

	Factorial of 4! = 4✖3✖2✖1 = 24.
	Factorial of 0! = 1.

Program

def fact(n):
    if n == 0:
        return 1;
    else:
        return n * fact(n-1)
        
n = int(input("Enter the Number\n"))
print("The Factorial of", n, "is", fact(n))

Output:

Enter the Number                                                                                                              
6                                                                                                                             
The Factorial of 6 is 720