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