# Python Program to Display the Multiplication Table

## Introduction

In this Python program, we will create a program to display the multiplication table for a given number. The user can input the number for which they want to generate the multiplication table, and the program will output the table up to a specified range. We will discuss the algorithm, provide the Python code, and explain how the program works.

## Understanding the Algorithm

The algorithm for displaying the multiplication table involves the following steps:

1. Input: Accept a number from the user for which the multiplication table will be generated.
2. Input Range: Accept the range up to which the multiplication table will be displayed.
3. Generate Table: Use a loop to calculate and print the product of the number with integers in the specified range.
4. Display Result: Print or display the multiplication table.

## Python Program for Displaying the Multiplication Table

``````def multiplication_table(number, range_limit):
# Display the multiplication table
print(f"Multiplication Table for {number} up to {range_limit}:")

# Loop to generate the multiplication table
for i in range(1, range_limit + 1):
product = number * i
print(f"{number} x {i} = {product}")

# Input: Get number and range from the user
num = int(input("Enter the number for the multiplication table: "))
limit = int(input("Enter the range for the multiplication table: "))

# Generate and display the multiplication table
multiplication_table(num, limit)
``````

## Output Example

### Example: Display Multiplication Table for 7 up to 10

``````Enter the number for the multiplication table: 7
Enter the range for the multiplication table: 10
Multiplication Table for 7 up to 10:
7 x 1 = 7
7 x 2 = 14
7 x 3 = 21
7 x 4 = 28
7 x 5 = 35
7 x 6 = 42
7 x 7 = 49
7 x 8 = 56
7 x 9 = 63
7 x 10 = 70
``````

## Explanation

The Python program defines a function `multiplication_table` that takes a number and a range limit as input. It then uses a loop to calculate and print the product of the given number with integers in the specified range.

In the example provided, the user inputs the number 7 and the range 10. The program then generates and displays the multiplication table for 7 up to 10.

## Conclusion

This Python program allows users to input a number and a range, and it outputs the multiplication table for that number within the specified range. You can experiment with different numbers and ranges to observe the program’s functionality.

If you have any questions or need further clarification, feel free to ask!