Answer:
From the program,
16! = 20922789888000
The python program is as follows:
n = int(input("Number: "))
if n < 0:
print("Positive integers only")
else:
result = 1
for i in range(1,n+1):
result = result * i
print(n,"! = ",result)
Explanation:
This line prompts user for input
n = int(input("Number: "))
This line checks if n is negative
if n < 0:
If yes, the following print statement is executed
print("Positive integers only")
If otherwise, the factorial of the input number is calculated
else:
This line initial the result to 1
result = 1
This line iterates from 1 to user input
for i in range(1,n+1):
This line multiply the value of each iteration to get the factorial of the input number
result = result * i
This line prints the factorial of the input number
print(n,"! = ",result)