Finding Factorial using While loop

5 1 0
                                        


What is Factorial?

Factorial is simply the product of an integer including all positive integers below the specific integer.

For example, the factorial of 3 is 6. Its because 3 x 2 x 1 = 6. 

Like wise, the factorial of 4 is 24.

In this activity, we will develop a python code that is capable to calculate the factorial of a given integer by the user.

# Ask for an input integer

# Calculate the factorial 

# Print the factorial

I have mentioned the code that I developed to find the factorial.

#Using the while loop to find factoriali = 1factorial = 1num = 1num = int(input("Number: "))while i < num + 1: factorial = factorial*i i+=1print (factorial)


Oops! This image does not follow our content guidelines. To continue publishing, please remove it or upload a different image.


You've reached the end of published parts.

⏰ Last updated: Jul 12, 2021 ⏰

Add this story to your Library to get notified about new parts!

Python programming for BeginnersWhere stories live. Discover now