Python Program To Find Factorial Using While Loop

Python Program To Find Factorial Using While Loop

Example

N = int(input("Enter a number: "))
 
factorial = 1
counter = 1
 
while counter <= N:
    factorial = factorial * counter
    counter = counter + 1
 
print("Factorial of ", N, " is: ", factorial)

Output:

Enter a number: 8
Factorial of  8  is:  40320

Leave a comment