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))
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
Post a Comment