Arithmetic Operators

Problem Statement

Let’s learn about Python’s arithmetic operators.

First, let’s read two integers:

a = int(raw_input())
b = int(raw_input())

Now, the three basic arithmetic operators are the following:

  • Addition (+)
  • Subtraction (-)
  • Multiplication (*)

(We’ll learn about division in the next task)

Task
Read two integers from STDIN and print three lines where:
(1) the first line contains the sum of the two numbers,
(2) the second line contains the difference of the two numbers (first – second),
(3) the third line contains the product of the two numbers.

Input Format
The first line contains the first integer, a, and the second line contains the second integer, b.

Constraints
1a1010
1b1010

Output Format
Print three lines as explained above.

Sample Input

3
2

Sample Output

5
1
6

Explanation
3+25
321
326

Solution

  
# Enter your code here. Read input from STDIN. Print output to STDOUT
a = int(raw_input())
b = int(raw_input())
print a+b
print a-b
print a*b

Leave a Reply