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.
Sreeni Gajapathy2,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 Parker210,111 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.