Write a Python Program to Print Multiplication Table

Write a Python Program to Print Multiplication Table
In this python program, we discuss the  Print Multiplication Table using the for loop and while loop.

Python Program to Print Multiplication Table using for loop

in this program, we will show the  Print Multiplication Table 7 to 9 using For Loop

for i in range(7, 9):
    for j in range(1, 11):
        print('{0}  *  {1}  =  {2}'.format(i, j, i*j))
    print('==============')

Here is the output.

7  *  1  =  7
7  *  2  =  14 
7  *  3  =  21 
7  *  4  =  28 
7  *  5  =  35 
7  *  6  =  42 
7  *  7  =  49 
7  *  8  =  56 
7  *  9  =  63 
7  *  10  =  70
============== 
8  *  1  =  8  
8  *  2  =  16 
8  *  3  =  24 
8  *  4  =  32 
8  *  5  =  40 
8  *  6  =  48 
8  *  7  =  56 
8  *  8  =  64
8  *  9  =  72
8  *  10  =  80
==============

Python Program to print multiplication table using while loop

In this program, we wrote about the python program to print multiplication tables using a while loop.

 

  i = int(input(" Please Enter any Positive Integer less than 10 : "))
while(i <= 10):
    j = 1
    while(j <= 10):
        print('{0}  *  {1}  =  {2}'.format(i, j, i*j))
        j = j + 1
    print('==============')
    i = i + 1

Here is the output of this python program.

Please Enter any Positive Integer less than 10 : 9
9  *  1  =  9  
9  *  2  =  18 
9  *  3  =  27 
9  *  4  =  36 
9  *  5  =  45 
9  *  6  =  54 
9  *  7  =  63 
9  *  8  =  72 
9  *  9  =  81 
9  *  10  =  90
============== 
10  *  1  =  10
10  *  2  =  20
10  *  3  =  30
10  *  4  =  40
10  *  5  =  50
10  *  6  =  60
10  *  7  =  70
10  *  8  =  80
10  *  9  =  90
10  *  10  =  100
==============

Leave a Comment

Verified by MonsterInsights