Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def factorial(x):
- if x==1:
- return 1
- else:
- return x*factorial(x-1)
- num = (float(input("Enter a number to calculate its factorial : ")))
- print("Factorial of "+str(num)+" is "+str(factorial(num))+".")
Add Comment
Please, Sign In to add comment