Home / Programs / Write a program to accept two numbers from the user and calculate multiplication
🚀 Programming Example

Write a program to accept two numbers from the user and calculate multiplication

👁 536 Views
💻 Practical Program
📘 Step Learning
Write a program to accept two numbers from a user using python then calculate multiplication.

📌 Information & Algorithm

Given Input:

Enter first number 12
Enter second number 4

Expected Output:

Multiplication is 48

Hints:

  • Use Python 3’s built-in function input() to accept user input
  • Convert user input to the integer type using the int() constructor.

💻 Program Code

num1 = int(input("Enter first number "))
num2 = int(input("Enter second number "))

res = num1 * num2
print("Multiplication is", res)
                        

🖥 Program Output

Enter first number 12
Enter second number 4
Multiplication is 48
                            

📘 Explanation

📚 Learning Subject

Master Programming Through Practical Examples

Improve your coding logic, problem-solving skills and programming confidence by practicing real-world examples with explanations.

🎯 How to learn from this example

First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.

🔥 Practice suggestion

Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.