Problem 107453 · easy · Phase 01 Prerequisites & Setup

Six-Line Calculator

input · int · arithmetic

Read two integers, a and b, each on its own line. Then print six lines, in this order:

  1. a + b (sum)
  2. a - b (difference)
  3. a * b (product)
  4. a // b (floor division: divide and round down to a whole number)
  5. a % b (remainder after division)
  6. a ** b (a raised to the power b)

Examples

Input:
7
2
Output:
9
5
14
3
1
49
Input:
-7
2
Output:
-5
-9
-14
-4
1
49
Explanation: -7 // 2 rounds down to -4 (not up to -3), and -7 % 2 is 1 because -7 = 2 * (-4) + 1.

Constraints

  • -100 <= a <= 100
  • 1 <= b <= 5 (so you never divide by zero)

Goals

  • Convert text from input() into a number with int()
  • Use the arithmetic operators + - * // % **
  • Predict the result of floor division and remainder for negative numbers
Starting Python…