We need to know the Mathematics of Multiplication. And hence this blog focuses on the program for multiplication tables in Python using a while loop. If you want to practice examples and Explanations of Python, then please use this reference to this URL. Also, See – the complete Python Practice Series.
Program to Print Multiplication Table in Python Using While Loop
n = int(input("Enter any Number :")); i = 1 while i < 11: value = n * i print(n," * ",i," = ",value) i = i + 1
Enter any Number :13 13 * 1 = 13 13 * 2 = 26 13 * 3 = 39 13 * 4 = 52 13 * 5 = 65 13 * 6 = 78 13 * 7 = 91 13 * 8 = 104 13 * 9 = 117 13 * 10 = 130
The above program is a simple program to print multiplication tables in Python using While Loop. Here, the user enters the input of any number of his choice, but since we have used “int”, it cannot accept the decimal values. Then we write the “while loop” which uses “i” as a counter variable. Then we used the range function which directs the loop to start from 1 and run till less than 11 i.e. 10.
Inside the while loop, multiply “i” by “n” and store in the result in the variable value. If you want the video explanation of the Program, don’t worry. We got you covered. Please go through the below video. All your queries will be resolved.
If you want to learn such python programming, you can see this – Python Online Course with Certification. It’s easy to understand and meant for beginners who have no background in programming.