Order of Operations

  1. Parentheses
  2. Exponentiation
  3. Multiplication, Division,
    Integer Division, Modulo
  4. Addition, Subtraction
x = 8 / 4 + 5 * (3 + 1) - 7 % 4



x = 8 / 4 + 5 * (3 + 1) - 7 % 4



x = 8 / 4 + 5 * (3 + 1) - 7 % 4
x = 8 / 4 + 5 *    4    - 7 % 4


x = 8 / 4 + 5 * (3 + 1) - 7 % 4
x = 8 / 4 + 5 *    4    - 7 % 4


x = 8 / 4 + 5 * (3 + 1) - 7 % 4
x = 8 / 4 + 5 *    4    - 7 % 4
x =  2.0  +    20       -    3

x = 8 / 4 + 5 * (3 + 1) - 7 % 4
x = 8 / 4 + 5 *    4    - 7 % 4
x =  2.0  +    20       -    3

x = 8 / 4 + 5 * (3 + 1) - 7 % 4
x = 8 / 4 + 5 *    4    - 7 % 4
x =  2.0  +    20       -    3
x = 19.0