Write OperatorTrace. Read two integers a and b, set x = a, then execute exactly these statements, printing the variables after each one:
x += b;
x *= 2;
x %= 7;
int y = x++;
int z = ++x;
int w = a-- - --b;
double average = (a + b) / 2;
and finally print (a + b) / 2.0. Fill in a trace table on paper first.
For the input
5 3
the program prints
x += b -> x = 8
x *= 2 -> x = 16
x %= 7 -> x = 2
y = x++ -> x = 3, y = 2
z = ++x -> x = 4, z = 4
w = a-- - --b -> a = 4, b = 2, w = 3
(a + b) / 2 = 3.0
(a + b) / 2.0 = 3.0