Python - Display a Multiplication Table

In this program, you will learn how to display a multiplication table for given number.

Program Code : Display a Multiplication Table



    # Enter the number
    num = int(input('Enter the  number to display multiplication table : '))
    
    #The range from 1 to 10
    for i in range(1,11):
        print(num, 'x', i, '=', num * i)
            
            

Output


    Enter the  number to display multiplication table : 9
    9 x 1 = 9
    9 x 2 = 18
    9 x 3 = 27
    9 x 4 = 36
    9 x 5 = 45
    9 x 6 = 54
    9 x 7 = 63
    9 x 8 = 72
    9 x 9 = 81
    9 x 10 = 90
            

In this program, you have used for loop along with range function to iterate it. We are given (1,11) values inside range funcation to iterate 10 times and displays multiplication 10 times.

You can use different range values and check multiplication table.



The following topics can be useful to understand this program.



Related Tutorials