Write a python program to print the factorial of the given no.
Answers
Answered by
9
- num = int(input("Enter a number: "))
- factorial = 1.
- if num < 0:
- print("Sorry, factorial does not exist for negative numbers")
- elif num == 0:
- print("The factorial of 0 is 1")
- else:
- for i in range(1,num + 1):
Answered by
3
Answer:
Hey! Here is your code in python...
def factorial(n):
prod = 1
while n>=1:
prod*=n
n = n-1
return prod
x = int(input("Enter a number: "))
f = factorial(15)
print("Factorial of", x, '=', f)
# HOPE THIS HELPS!!
Similar questions