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.

C# C# Basics (Retired) Perform Order of Operations

ibrahim adan hassan jama
ibrahim adan hassan jama
552 Points

what should i start with ??

Use what you learned about the order of math operations to solve this problem. You can use a calculator.

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

2 Answers

First, multiplication, division and modulo all have higher precedence than addition. The next rule to apply would be that operator precedence proceeds from left to right.

This expression could have been written as: (8*7) + (8%5) + (6/2).

8%5 would be 3 since the remainder of 8/5 is 3.
The answer for the expressions is 62

Thanks heaps for the clear explanation MargaretAnne!