Part of the series

Several example codes

~1 min read • Updated Oct 7, 2025

Program Overview

This Python program reads two integers x and y from the user.
It then calculates and displays the multiplication results of y with numbers from 1 to x.


Python Code:


x = int(input("Enter x: "))
y = int(input("Enter y: "))

print(f"\nMultiplication table of {y} up to {x}:")

for i in range(1, x + 1):
    result = i * y
    print(f"{i} × {y} = {result}")

Sample Output:


Enter x: 5  
Enter y: 3  

Multiplication table of 3 up to 5:  
1 × 3 = 3  
2 × 3 = 6  
3 × 3 = 9  
4 × 3 = 12  
5 × 3 = 15

Step-by-Step Explanation:

- The program first reads two integers: x and y
- It uses a for loop from 1 to x
- In each iteration, it multiplies i by y and prints the result


Written & researched by Dr. Shahin Siami