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 trialLone Nielsen
13,764 PointsI cant find the right answer can anyone help me?
Please fill in the correct answer in each blank provided below.
Fill in the blank in the code below in order to produce a floating point (double) result of 'x' divided by 'y'? int x = 4; int y = 6; return ?? // my answer: (double)y / (double)x;
2 Answers
Sara Rena Anderson
15,045 Pointsint x = 4; int y = 6; return (double)x/y;
Steven Parker
231,198 PointsThe question asked for the "result of 'x' divided by 'y'", but your answer divides 'y' by 'x' instead.
BTW: the casting is fine, but you really only need to cast the first variable because then the operation between a double and an int will produce a double.