What are the values of the following expressions assuming th
What are the values of the following expressions, assuming that n is 17 and m is 18?
n / 10 + n % 10 =
n % 2 + m % 2 =
(m + n) / 2 =
(m + n) / 2.0 =
(int) (0.5 * (m + n)) =
(int) Math.round(0.5 * (m + n)) =
Solution
Assuming the output required is in decimal and m and N are double.
n / 10 + n % 10 = 8.7
n % 2 + m % 2 = 1
(m + n) / 2 = 17.5
(int) (0.5 * (m + n)) = 17
(int) Math.round(0.5 * (m + n)) = 18
