Display the Addition, Subtraction, Multiplication & Division of 20 and 50 Using Two Variables
Introduction
In Python, we can store numbers in variables and perform arithmetic operations like addition, subtraction, multiplication, and division.
Logic to Write the Code
- Start the program.
- Assign the value
20to variablex. - Assign the value
50to variabley. - Perform addition, subtraction, multiplication, and division.
- Display the results using the
print()function. - End the program.
Source Code (Beginner Friendly)
# Python program to perform arithmetic operations using two variables
# Assigning values
x = 20
y = 50
# Performing operations
print("Addition:", x + y)
print("Subtraction:", x - y)
print("Multiplication:", x * y)
print("Division:", x / y)
Sample Output
Addition: 70
Subtraction: -30
Multiplication: 1000
Division: 0.4
Viva Questions with Answers
1. Which operator is used for addition in Python?
The + operator is used for addition.
2. What is the result of 20 – 50?
The result is -30.
3. What is the symbol used for division?
The / symbol is used for division.
4. Does division always return an integer in Python?
No, division returns a float value.
5. Can variables store numeric values?
Yes, variables can store integers and decimal numbers.
