Math for Computer Science

7 | The order of operations

Back to Table of Contents
Previous Lesson Next Lesson

Examples
Practice Problems

Introduction

What is the order of operations?

Considering addition, subtraction, multiplication and division, operations are evaluated in the following order:

  1. Evaluate operations within parentheses
  2. Evaluate multiplication and division from left to right
  3. Evaluate addition and subtraction from left to right

Examples

The order of operations (no parentheses)

Q: Evaluate: 3 + 4 × 5

A: The order of operations dictates that multiplication must be evaluated before addition:
3 + 4 × 5 = 3 + 20 = 23


The order of operations (no parentheses)

Q: Evaluate: 6 ÷ 3 × 2

A: The order of operations dictates that multiplication and division are evaluated from left to right:
6 ÷ 3 × 2 = 2 × 2 = 4


The order of operations (with parentheses)

Q: Evaluate: (3 + 4) × 5

A: The inclusion of parentheses changes the order in which the operations must be evaluated:
(3 + 4) × 5 = 7 × 5 = 35.

Practice | The order of operations

Click "Create Report" upon completion of any practice set to document your progress: Example