Class Exercise on Operator precedence
Given that
A := 1; B := 2; C := 4;
What does X equal after each of the following statements,
X := A / B / C; ________________
X := A + B / C; ________________
X := A * B * C; ________________
X := A * B - C; ________________
X := A + B + C; ________________
X := A / B * C; ________________
X := A * B / C; ________________
X := A + B - C; ________________
X := A / B / C; 0.125
X := A + B / C; 1.5
X := A * B * C; 8
X := A * B - C; -2
X := A + B + C; 7
X := A / B * C; 2
X := A * B / C; 0.5
X := A + B - C; -1
Copyright B Brown/P Henry/CIT, 1988-1997. All rights reserved.