Five Arithmetic Results
Easyjava
Read two integers a and b and print the five basic arithmetic results.
Input: two integers separated by whitespace (b is not zero).
Output: five lines:
Sum: <a+b>
Difference: <a-b>
Product: <a*b>
Quotient: <a/b>
Remainder: <a%b>Example 1
Input
17 5
Output
Sum: 22 Difference: 12 Product: 85 Quotient: 3 Remainder: 2
- -100000 <= a, b <= 100000
- b != 0
Hint 1
Use +, -, *, / and % on a and b.
Hint 2
Quotient uses integer division; Remainder uses %.
Apply each of the five arithmetic operators to a and b. Remember that / on two ints truncates and % returns the remainder (with the sign of the left operand).