1. Write a program that demonstrates the operator ++ by performing the following
tasks:
• Use Scanner to read an Integer value
x.
• Compute
x++ and store the result in
y.
• Display
x
and
y
clearly labeled.
• Compute ++x
and store the result in
z.
• Display
x
and
z
clearly labeled.
Try your program with positive and negative values of
x. What can you
conclude about pre and post increment?
2. If u = 1, v = 2, w = 3, × = 4, and y = 10, what is the value of each of the
following expressions, assuming int variables?
• u - v * (w + x)
• u + y / v * (w + x)
• ++v / (v + u) * w