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 trialGundra Kiran
Courses Plus Student 5,931 Points(25 + 35) / 2 * (4/2) please split this for me because when I compute using precedence rule I get 15.
The way I compute is step 1: (25 + 35) / 2 * (4/2) Step 2: 60 / 2 * 2 step 3: 60 / 4 step 4: 15 but the answer you provided to me is 60, how is it possible?
1 Answer
Steven Deutsch
21,046 PointsHey Gundra Kiran,
The order of precedence is:
Parentheses
Multiplication, Divison, and Remainder
Addition and Subtraction
Operators with the same priority will work from left to right. In this case:
(25 + 35) / 2 * (4/2) =
(60) / 2 * (2) =
30 * 2 = 60
Good Luck!
Gundra Kiran
Courses Plus Student 5,931 PointsGundra Kiran
Courses Plus Student 5,931 PointsReally Great help, I appreciate your instant response Thank you.