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

Popular posts from this blog

Simple Python Program Code for Snake Game

Project 01: Python Code for Music Recommendation with Explanation