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 trial

C# C# Basics (Retired) Perfect Integers and Doubles

olu adesina
olu adesina
23,007 Points

CANT SEEM TO GET THIS QUESTION RIGHT HELP

NOT SURE IN WHAT ORDER TO DO THIS HELP

Steven Parker
Steven Parker
229,732 Points

You didn't say which question (the quiz has 7).

olu adesina
olu adesina
23,007 Points

oh sorry it was question 7

Steven Parker
Steven Parker
229,732 Points

OK, this quiz is always the same. But for future reference, many quizzes scramble the question order each time, so it's better to quote the entire question.

1 Answer

Steven Parker
Steven Parker
229,732 Points

It's a matter of operator precedence and associativity.

The operator precedence of multiplication and division is the same, and the associativity is left-to-right, so you would do the division first, and then the multiplication.

But be aware of the number types, both division operands are integers, so the rules for integer math will apply there. But since one of the multiplication operands is a double, the double rules will apply to that part.

For future reference, here's a handy chart of Precedence and Associativity of C Operators.