Factorial of a Number in Python

This program calculates the factorial of a given positive integer.

 
n = int(input("Enter a positive integer: "))
factorial = 1
for i in range(1, n + 1):
    factorial *= i
print(f"Factorial of {n} = {factorial}")

No comments:

Post a Comment

MS Excel Logical Functions

Logical functions in Excel are powerful tools that help you make decisions based on conditions. Whether you're comparing values or testi...

Post Count

Loading...