Calculations (also called expressions) that involve a number of operators are evaluated according to operator precedence. You can think of precedence as being similar to priority, in that different arithmetic operators have different priorities in relation to how the calculation will be carried out. The highest priority applies to expressions surrounded by brackets, and next expressions involving *, / and % until finally, the + and – operators.

Example 1: Number1 + Number2 / 2

is different from

Example 2: (Number1 + Number2) / 2

Using the following test data you can see the difference between the two:

Number1 = 6 and Number2 = 10

Example 1: Division first, then Addition: 10 / 2 = 5 then 6 + 5 = 11

Example 2: Addition first, then Division: 6 + 10 = 16 then 16 / 2 = 8

One way to help remember operator precedence is to use the acronym BODMAS.

This shows operator priority from left to right: