Articles

# Program to print multiplication table of a given number in Python

In this python programming guide, we are going to learn

• program to print multiplication table of a given number in python

### Python program to print multiplication table of a number

The program to print multiplication table of a given number in python is as follows:

``````# Owner : TutorialsInhand Author : Devjeet Roy

num = int(input("Enter a number: "))

print("The multiplication table is as follows:")

for i in range(1,11):
print("{} x {} = {}".format(num,i, num*i))``````

The output of python program to print multiplication table of a number is as follows:

``````PS C:\Users\DEVJEET\Desktop\tutorialsInHand> python code.py
Enter a number: 4
The multiplication table is as follows:
4 x 1 = 4
4 x 2 = 8
4 x 3 = 12
4 x 4 = 16
4 x 5 = 20
4 x 6 = 24
4 x 7 = 28
4 x 8 = 32
4 x 9 = 36
4 x 10 = 40``````

We can enter other number as input in above python program to print multiplication table of a given number and check the output.

1. First we ask the user to input a number and then we convert the data type to integer type.

2. Then by repeating a loop from 1 to 10, a multiplication table is being printed.

3. The format() method replaces the placeholder "{}" with a given value.

Program to print multiplication table of a given number in python snapshot: Basic Python Programs

Would you like to see your article here on tutorialsinhand. Join Write4Us program by tutorialsinhand.com 