Mathematics I / Variables, Types, and Expressions
Practice question · Put in order

Order the evaluation steps of the expression 2 + 3 * (8 - 6) / 2.

Hints
  1. Parentheses first, then the tighter-binding operators, then the looser ones.
  2. Multiplication and division share a precedence level, so they run left to right.
Show the answer
  1. Evaluate the parentheses: 8 - 6 = 2
  2. Multiply: 3 * 2 = 6
  3. Divide: 6 / 2 = 3
  4. Add: 2 + 3 = 5
Why

The value is 5. Because * and / bind equally, the multiplication is done before the division simply by position; had you divided first the answer would be unchanged here, but with integer division it would not be.

Read the lesson: Variables, Types, and Expressions →

Practise Variables, Types, and Expressions

The app has 4 more questions on this lesson, and keeps your place in the course. Mathematics I is free to start.

More questions on Variables, Types, and Expressions