Python program to find factorial of number using recursive function.

#Python program to find factorial of number using recursive function.

def fact(n):
    if(n==1):
        return n
    else:
            return n*fact(n-1)

N=input("Enter number to find its factorial:")
N=int(N)

if(N==0):
    print("Factorial of %d is 1."% N)
else:
    print("Factorial of %d is:"% N,fact(N))

Comments

Popular posts from this blog

Python program to calculate age and year when user will be 100 years old

Python program to print numbers less than 5 from the list.