# Python Program to Display Multiplication Table

You are Here:

## Using for Loop

In the following example, we will create and display the Multiplication Table for the given number (9) using for loop

### Example

Python Compiler
table = 9 length = 10 print("Multiplication table: %d" % table) for i in range(1, length+1): print("%2d * %d = %d" %(i, table, i*table))

### Output

Multiplication table: 9 1 * 9 = 9 2 * 9 = 18 3 * 9 = 27 4 * 9 = 36 5 * 9 = 45 6 * 9 = 54 7 * 9 = 63 8 * 9 = 72 9 * 9 = 81 10 * 9 = 90

## Using while Loop

In the following example, we will create and display the Multiplication Table for the given number (9) using while loop

### Example

Python Compiler
table = 9 length = 10 i = 1 print("Multiplication table: %d" % table) while(i <= length): print("%2d * %d = %d" %(i, table, i*table)) i += 1

### Output

Multiplication table: 9 1 * 9 = 9 2 * 9 = 18 3 * 9 = 27 4 * 9 = 36 5 * 9 = 45 6 * 9 = 54 7 * 9 = 63 8 * 9 = 72 9 * 9 = 81 10 * 9 = 90

## Display Customized Table

In the following example, we will display the table according to the given table number and table length.

### Example

Python Compiler
table = int(input("Enter the table number: ")) length = int(input("Enter the table length: ")) print("\nMultiplication table: %d" % table) for i in range(1, length+1): print("%2d * %d = %d" %(i, table, i*table))

### Output

Enter the table number: 14 Enter the table length: 5 Multiplication table: 14 1 * 14 = 14 2 * 14 = 28 3 * 14 = 42 4 * 14 = 56 5 * 14 = 70

## Reminder

Hi Developers, we almost covered 90% of String functions and Interview Question on Python with examples for quick and easy learning.

We are working to cover every Single Concept in Python.