1. Engineering
  2. Computer Science
  3. 10 given the following program fragments int i 4...

Question: 10 given the following program fragments int i 4...

Question details
  1. (10) Given the following program fragments:

int i = 4, j = 17;

float z = 2.6;

Determine the value of each of the following expressions. If the result is a floating point value, include a decimal point in your answer.

  1. i / (float) j
  2. 1.0 / i + 2
  3. z * j
  4. i + j % i
  5. (1/2) * i
  6. 2 * i + j – i
  7. j / 2
  8. 2 * 3 – 1 % 3
  9. i % j / i
  10. (int)(z + 0.5)
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution