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!
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 trial
Sreeny G2,382 Points
is 8*7+8%5+6/2 same as (8*7)+(8%5)+(6/2)?
I end up with 60 for the below expression. Please advise where I'm doing it wrong.
My thoughts: we have *, %, /, + so with order of precedence (left to right), I do this: 56 + 1 + 3 = 60.
Steven Parker225,712 Points
It looks like you understand the operator precedence correctly .. that's most of it!
But 8 % 5 does not equal 1.
The "%" symbol is the modulus or remainder operator. It gives you what would be left over after a divide. So, for example, 12 % 10 would be 2.