def fact_recurse(n):
if n==1:
return n
else:
return n*fact_recurse(n-1)
num=int(input("Enter an integer to find factorial : "))
if num<0
:
print("Factorial of negative numbers does not exist.")
elif num==0:
print("Factorial of 0 is 1.")
else:
print("Factorial of ",num," is ",fact_recurse(num))
No comments:
Post a Comment