## 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.

# Dont understand this at all.

No clue what Y is or how to solve it.

Hi Matt,

Did you understand the first 6 questions in the quiz? I am going to assume that you did and it's just the fact that question 7 is a bit different that is causing the confusion.

```int a = 3;
int b = 2;
double c = 3.5;
double y = a / b * c;

y = ?
```

Start by using the declared values for a,b & c

y = 3 / 2 * 3.5

a and b were both declared as integers. Doing math with integers always results in an integer. Anything after the decimal point is truncated. Therefore 3 / 2 = 1

So we now have y = 1 * 3.5 which equals 3.5.

y was declared as a double, so it can contain 3.5, therefore

y = 3.5

I was multiplying 2 * 3.5 first because I thought the multiplication occurred first. That's why I could never get it. I watched the video several times.

Understandable.

The * / and % operators are all part of the 'Multiplicative' category and are given the same level of precedence.

So when you have y = a / b * c the '/' & '*' both have the same level so they are dealt with in the order in which they appear working from left to right.

Hence in this example the / happens first and then the *.

Thanks man, that helps a lot.

Thanks man, that helps a lot.