Python program for factorial using recursion
# Factorial recursion program
def fact(n):
if(n==1):
return 1
else:
return n*fact(n-1)
number=input("\n Enter the number")
result=fact(number)
print "the factorial of",number,"is ",result
def fact(n):
if(n==1):
return 1
else:
return n*fact(n-1)
number=input("\n Enter the number")
result=fact(number)
print "the factorial of",number,"is ",result
Comments
Post a Comment