Program to display the multiplication table in Python using for loop. This program uses for loop and multiplication as arithmetic operation to print the multiplication table of a input number . This program is useful for beginners, class 11,12 and B Tech computer science students. Download source code.
Program to display the multiplication table in Python
We will print the multiplication table of any number (from 1 to 10) by using the for loop.
Source code : Program to display the multiplication table in Python
number = int(input ("Enter the number of which the user wants to print the multiplication table: "))
# We are using "for loop" to iterate the multiplication 10 times
print ("The Multiplication Table of: ", number)
for count in range(1, 11):
print (number, 'x', count, '=', number * count)
Download Source code : For Download Click on the below Button
Stepwise Source code explanation
Step 1 : First input of the number whose table has to be displayed is captured.
number = int(input (“Enter the number of which the user wants to print the multiplication table: “))
Step 2 : The input number is printed.
print (“The Multiplication Table of: “, number)
Step 3 : The loop is used to iterate the multiplication.
for count in range(1, 11):
Step 4: The number is printed
print (number, ‘x’, count, ‘=’, number * count)
Output :
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license()" for more information. >>> RESTART: C:/Users/ARCHIT/AppData/Local/Programs/Python/Python37-32/test1.py Enter the number of which the user wants to print the multiplication table: 6 The Multiplication Table of: 6 6 x 1 = 6 6 x 2 = 12 6 x 3 = 18 6 x 4 = 24 6 x 5 = 30 6 x 6 = 36 6 x 7 = 42 6 x 8 = 48 6 x 9 = 54 6 x 10 = 60 >>>
Output Explanation :
The input is captured.
The Multiplication Table of: 6
The table of the input number.
6 x 1 = 6
6 x 2 = 12
6 x 3 = 18
6 x 4 = 24
6 x 5 = 30
6 x 6 = 36
6 x 7 = 42
6 x 8 = 48
6 x 9 = 54
6 x 10 = 60
Thank you for reading and learning from Program to display the multiplication table in Python using for loop post. This program uses for loop and multiplication as arithmetic operation to print the multiplication table of a input number . This program is useful for beginners, class 11,12 and B Tech computer science students. Below are more program to practice and 11, 12 practical file link.
Python Programs Archives – CS Study
Computer Science Practical file for class 12 Term-2 – CS Study
Computer Science with Python Practical Book Solutions Class 11 Term -2 – CS Study