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

Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Best Website and Software Company in Allahabad