Part of the series

Several example codes

~1 min read • Updated Oct 6, 2025

Program Overview

This Python program reads two integers from the user and calculates their product using the * operator.
In this example, the first number is 7 and the second is 2, so the output will be 14.


Python Code:


# Read two integers
a = int(input("Enter the first number: "))
b = int(input("Enter the second number: "))

# Calculate the product
result = a * b

# Display the result
print(f"{a} × {b} = {result}")

Sample Output for a = 7 and b = 2:


7 × 2 = 14

Step-by-Step Explanation:

- The user enters two integers
- The program multiplies them using the * operator
- The result is printed in a formatted string showing the full equation


Written & researched by Dr. Shahin Siami