What will be the result of int a = b * (-c + 2) / 2; Assume b = 5 and c = 10.


What will be the result of the following assignment statement? Assume b = 5 and c = 10.


int a = b * (-c + 2) / 2;

a) 30

b) –30

c) 20

d) –20

e) –6

Answer: d. Explanation: The unary minus is applied first giving –c + 2 = -8. Next, the * is performed giving 5 * - 8 = -40, and finally the / is performed giving –40 / 2 = -20.