Given this code fragment:
What is the output?
With integer arithmetic, multiplication and division have the same precedence and are evaluated from left to right. Integer division truncates fractional results, so 3 / 2 evaluates to 1; the computed values are r1 = 7, r2 = 2, and r3 = 3.
3 / 2
1
r1 = 7
r2 = 2
r3 = 3
Community Discussion