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# Streams and Data Processing Parsing Data Review

Lone Nielsen
Lone Nielsen
13,764 Points

I 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

int x = 4; int y = 6; return (double)x/y;

Steven Parker
Steven Parker
231,248 Points

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