0

What’s wrong here..?

TrYING TO GET A DOUBLE INPUT AND PRINT IT. THE RESULT IS VERY STRANGE...NO MATTER WHAT THE INPUT IS, THE OUTPUT IS 55 OR 56 OR 57...STRANGE static void Main(string[] args) { Console.Write("x1="); double xone= Convert.ToDouble(Console.Read()); Console.WriteLine (xone); }

21st Oct 2019, 2:51 PM
Sharon Keren
Sharon Keren - avatar
2 odpowiedzi
+ 4
double xone = Convert.ToDouble(Console.ReadLine()); Use ReadLine() rather than Read() P.S. Why you write some text above in ALL CAPS?
21st Oct 2019, 3:06 PM
Ipang
+ 1
My ipad keyboard malfunction. Thank you for the advice. (Now from my android cell :-))
22nd Oct 2019, 2:09 AM
Sharon Keren
Sharon Keren - avatar