Python Program to Find Factorial of the Number Using for Loop
# Find Factorial of the Number in Python Using for Loop # accept input from user n = int(input("Enter any number: ")) f = 1 # for loop to calculate factorial of a number for i in range(n, 0, -1): f *= i # print output print("Factorial is", f)
Output:
Enter any number: 5
Factorial is 120