Programming Examples
Python program to print the factorial of this number.
Given an integer number n, write a python program to print the factorial of this number.
- If input is: 4 then output should be: 24
- If input is: 5 then output should be: 120
- If input is: 6 then output should be: 720
- If input is: 7 then output should be: 5040
- If input is: 8 then output should be: 40320
- If input is: 10 then output should be: 3608800
n = int(input("Enter a number: "))
fact = 1
for i in range(1, n + 1):
fact *= i
print(fact)
Output