Dynamic programming · Exercise 73 of 100
Infix evaluation
In infix notation, each arithmetic operator sits between its operands. Evaluate groups inside parentheses first, working from the innermost group outward. Within each group, do multiplication and division before addition and subtraction, working left to right among operators with equal priority.
Try it yourself
What is the value of 27 - (2 + 3) × 4?
One-step hint
Underline the parenthesized sum and replace it with one number. Identify the entire product being subtracted from 27.
Worked solution
- The parentheses group 2 and 3 together, so replace their sum with 5.
- Multiplication comes before subtraction, so multiply 5 by 4 to get 20, then subtract 20 from 27 to get 7.