Casting and Ranges of Variables

AP Computer Science A· difficulty 3/5

Given <code>double avg = 7.8;</code>, the result of <code>(int)(avg * 10) / 10.0</code> is

  • A

    78.0

  • B

    7.0

  • C

    7.8

    check_circle
  • D

    0.78

Explanation

avg*10 = 78.0; (int)78.0 = 78; 78 / 10.0 = 7.8.

Want 10 more like this — adaptive to your weak spots?

Related questions