Guest User

Untitled

a guest
Oct 23rd, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. def factorial(x):
  2. if x==1:
  3. return 1
  4. else:
  5. return x*factorial(x-1)
  6. num = (float(input("Enter a number to calculate its factorial : ")))
  7. print("Factorial of "+str(num)+" is "+str(factorial(num))+".")
Add Comment
Please, Sign In to add comment