# Python Program To Generate Multiplication table

## Problem Definition

Create a Python Program to generate the multiplication table of a number.

## Program

``````num = int(input("Enter the Number :"))

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

#### Output

``````Enter the Number :3
3 x 1 = 3
3 x 2 = 6
3 x 3 = 9
3 x 4 = 12
3 x 5 = 15
3 x 6 = 18
3 x 7 = 21
3 x 8 = 24
3 x 9 = 27
3 x 10 = 30``````

#### Explanation

First, we are taking input from the keyboard using the user using the `input()` method then later we are computing the table using a for loop in range of 1 to 11 then we are simply printing out the result using string formatting.

Alternatively, if you are using `Python 3.6` or above you can take advantage of `f-strings` for string formatting.

## Program

``````num = int(input("Enter the Number :"))

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

#### Output

``````Enter the Number :3
3 x 1 = 3
3 x 2 = 6
3 x 3 = 9
3 x 4 = 12
3 x 5 = 15
3 x 6 = 18
3 x 7 = 21
3 x 8 = 24
3 x 9 = 27
3 x 10 = 30``````

## Using While Loop

``````num = int(input("Enter the Number :"))

i = 1
while(i<=10):
print("{} x {} = {}".format(num,i,num*i))
i += 1``````

#### Output

``````Enter the Number :4
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``````

PROGRAMS

# Latest Articles

Latest from djangocentral

## Capturing Query Parameters of request.get in Django

In Django, the request object contains a variety of information about the current HTTP request, including the query parameters. Query parameters are a way to pass additional information in the URL and are used to filter or sort data. The request object p…