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

Iris Flowers Classification ML Project with Code

Data exploration and scatter plot visualization in Python using Pandas and Matplotlib