+ 1

Convert.ToFloat isn't works?

i was coding then i noticed that double x = Convert.ToDouble(Console.Readline()); works. but float x = Convert.ToFloat(Console.Readline()); doesn't works. Whyyy?

1st Feb 2019, 3:40 PM
Wiktor KuĆșniar
1 Answer
+ 7
What you're looking for is actually Convert.ToSingle method from System library which returns a single-precision floating-point value. You may find out more about Convert methods in official document at https://docs.microsoft.com/en-us/dotnet/api/system.convert Hopefully it helps! 😉
1st Feb 2019, 4:13 PM
Zephyr Koo
Zephyr Koo - avatar