Python program to Get Factorial Using a While Loop

x = abs(int(input("Insert any number: ")))
factorial =1
while x > 1:
 factorial *= x
 x -= 1
print("The result of factorial = ", factorial)

 

 

Output:

Insert any number: 4
The result of factorial =  24

 

Insert any number: 12
The result of factorial =  479001600

Subscribe For Daily Updates

100+ Python Pattern Examplespython pattern examples - star patterns, number patterns