Parse arithmetic with unusual precedence
Expressions, Operators & Types

Answer & solution
Official answer: 6
Approach: Build the grouping from the stated table, not from ordinary mathematical or C precedence. Associativity decides grouping only among operators at the same precedence.
1. Highest-precedence additions group (3+1+5)=9 and (7+2)=9. The expression becomes 9*2/9−4−7−6/2.
2. Subtraction has higher precedence than multiplication and division and is right-associative. Its group is 9−(4−(7−6)). Evaluate inward: 7−6=1, 4−1=3, 9−3=6.
3. The expression is now 9*2/6/2. Multiplication is next, giving 18/6/2.
4. Division is right-associative, so this means 18/(6/2), not (18/6)/2. The inner quotient is 3 and the result is 18/3=6.
Answer: 6. A fully parenthesized form is ((3+1)+5)*2 / (((7+2)−(4−(7−6)))/2). Both actual divisions are exact, so no integer-rounding issue arises.







