Back to Mathematical Foundations
BeginnerChildren

Order of Operations (PEMDAS)

When you have a math problem with many operations, how do you know which one to do first? We use the Order of Operations, which you can remember with the acronym **PEMDAS**.

**P** - Parentheses: Always solve what's inside parentheses first.
**E** - Exponents: Next, solve any exponents (powers).
**M/D** - Multiplication and Division: Do these from left to right, whichever comes first.
**A/S** - Addition and Subtraction: Finally, do these from left to right.

Let's try an example: 10 + 2 * 3
1. No Parentheses or Exponents.
2. Multiplication first: 2 * 3 = 6.
3. Now the problem is 10 + 6.
4. Addition last: 10 + 6 = 16.

Another one: (3 + 2) * 4
1. Parentheses first: 3 + 2 = 5.
2. Now the problem is 5 * 4.
3. Multiplication last: 5 * 4 = 20.

This order is very important in programming, as computers follow it exactly!

Calculate with PEMDAS

Calculate the result of the expression `5 * (4 - 2) + 10` following the order of operations and print the final number.