Question: (10) Given the following program fragments: int i = 4, j = 17; float z = 2.6; Determine the value of each of the following

  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)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!