def factorial(n):
if n == 0 or n == 1:
return 1
else:
return n * factorial(n-1)
# Input: Enter the value of 'num' to calculate the factorial for a different number
num = int(input("Enter a positive Integer"))
if(num>=0)
result = factorial(num)
print("The factorial of {num} is: {result}")
No comments:
Post a Comment