Given : integer x = 40, y = 35, z = 20, w = 10. Comment about the output of the following two statements:
print x * y / z – w
print x * y / (z – w) ?

A. Differ by 80

B. Same

C. Differ by 50

D. Differ by 160

Answer : A. Differ by 80

Explanation :

print x * y / z – w = 40 * 35 / 20 – 10 = 60
print x * y / (z – w) = 40 * 35 / ( 20 – 10 ) = 140
Difference is 80

Categorized in: