## Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

### Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today. PLUS

# Use what you learned about the order of math....... can some help with this? 8 * (7 + 8) %

Use what you learned about the order of math operations to solve this problem. You can use a calculator.......... can someone help with this cause I want to go forward until i get this

8 * (7 + 8) % 5 + 6 / 2 =

I like to use PEMDAS (Parenthesis, Exponents, Multiplication, Division, Addition, and Subtraction). We won't be using exponents so just ignore that for now. I use this to identify the order of operations. So first, we do what's in parenthesis.

8 * (7 + 8) % 5 + 6 / 2 ----> 8 * (15) % 5 + 6 / 2

Then, we do Multiplication, Division and the Modulus Operator (%). (just think of the M as Multiplication and Modulus).

Note: Even though there are multiple actions taking place at the same time in this step, we do it from left to right.

We first perform (8 * 15), then (120 % 5), and then (6 / 2). Notice how we skipped the + as weren't finished calculating the values of higher priority (Aka: Multiplication, Division, Modulus).

8 * (15) % 5 + 6 / 2 ---> 120 % 5 + 6 / 2 ---> 0 + 6 / 2 ---> 0 + 3

You see that with the modulus (%) operator, you only use the remaining value. Since 5 goes into 120 exactly 24 times, the remaining value is 0. But if you were to do 10 % 3 , for example, the remaining value would be 1, as 3 can only go into 10 three times, leaving a value of 1 unsatisfied.