Factorial Using Recursion

Program to find factorial of the given number using recursive function.  

def fact(n):  

    return 1 if (n==1 or n==0) else n * fact(n - 1);  

number = int(input(" Please enter any Number to find factorial : "))  

print("Factorial of",number,"is",fact(number))  





OUTPUT

 

Please enter any Number to find factorial : 5

The factorial of 5  = 120