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 Numbers Math Operations and Converting Types

Elfar Oliver
Elfar Oliver
3,924 Points

Didn't get it right but I entered the next course regardless. Could I have the answer to learn from it?

I know 2.5 x 2.5 is 6.25. int doesn't work and 2.5 doesn't work and after that I'm not so sure

1 Answer

Steven Parker
Steven Parker
231,248 Points

An int.Parse would return just the whole-number part (2). To get the actual value of 2.5, you'd do this:

:point_right: 6.25 / double.Parse("2.5")

Elfar Oliver
Elfar Oliver
3,924 Points

Nice, thank you. I'll redo the test for practice