Program to find the factorial of a given number using a while loop in Python:
# While loop in Python - Factorial of a number
num = int(input("Enter a number: "))
fact = 1
while num > 0:
fact *= num
num -= 1
print("The factorial of the given number is:", fact)
Comments
Post a Comment