def recur_factorial(n): #user-defined function
if n == 1:
return n
else:
return n*recur_factorial(n-1)
# take input
num = int(input("Enter number: "))
# check number is positive, negative, or zero
if num < 0:
print('Factorial does not exist for negative numbers')
elif num == 0:
print('The factorial of 0 is 1')
else:
# calling function
print('The factorial of',num,'is', recur_factorial(num))