Python Program to Display the Multiplication Table | Print table in Python

Posted in

Python Program to Display the Multiplication Table | Print table in Python
vinaykhatri

Vinay Khatri
Last updated on November 21, 2024

    Here we have provided a python program that asks the user to enter a number and its multiplication table.

    Prerequisite Topic to Create Print table in Python

    • Python Input, Output
    • Python Data types
    • Python Type Conversion
    • Python For loop
    • Python Arithmetic Operator
    Steps
    • First, we will ask the user to enter a number
    • Using the int() function we will convert the entered number into an integer value.
    • Using the for loop and multiplication operator we print the table of the entered number.

    Python Program to Display the multiplication Table

    Print Table in Python Program

    num =int(input("Enter a Number: "))
    for i in range(1,11):
        print(num,"x",i,"=",num*i )

    Output 1:

    Enter a Number: 30
    30 x 1 = 30
    30 x 2 = 60
    30 x 3 = 90
    30 x 4 = 120
    30 x 5 = 150
    30 x 6 = 180
    30 x 7 = 210
    30 x 8 = 240
    30 x 9 = 270
    30 x 10 = 300

    Output 2:

    ???????Enter a Number: 17
    17 x 1 = 17
    17 x 2 = 34
    17 x 3 = 51
    17 x 4 = 68
    17 x 5 = 85
    17 x 6 = 102
    17 x 7 = 119
    17 x 8 = 136
    17 x 9 = 153
    17 x 10 = 170

    People are also reading:

    Leave a Comment on this Post

    0 Comments