Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMichael North
2,561 PointsOrder of Operation are not working
I have run through the problem many times and even in the console, but the c# oder of ops gives me the wrong answer. This may be a bug or I am just completely wrong. Please Help!
4 Answers
james south
Front End Web Development Techdegree Graduate 33,271 Pointsthe quiz does not have a bug. left to right (1) anything in parens (), then (2) multiplication, division and modulo are of the same priority, then (3) addition and subtraction are of the same priority. so do operation in parens, then look for mult, div and mod, do those left to right, then look for add and sub, do those left to right.
Michael North
2,561 PointsI need help on #1, but I will still need help on others swell.
Seth Kroger
56,413 PointsThe first one is 8 * 7 + 8 % 5 + 6 / 2 = ???. There are no parentheses so we start with *, /, and % left to right.
8 * 7 + 8 % 5 + 6 / 2 -> 56+ 8 % 5 + 6 / 2
56 + 8 % 5 + 6 / 2 -> 56 + 3 + 6 / 2
56 + 3 + 6 / 2 -> 56 + 3 + 3
Then the addition:
56 + 3 + 3 = 62
Michael North
2,561 PointsThank you very much that helps a lot!
Michael North
2,561 PointsMichael North
2,561 PointsBut my answer still comes to seven when i do what you say. What did you get
Seth Kroger
56,413 PointsSeth Kroger
56,413 PointsThere are 3 questions to the quiz, each with different answers. It would be helpful to know which question you're asking about. (FYI none of the quiz answers I see are 7),