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/ Explanation:

Latest Current Affairs 2026 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad