Which is/are the correct method(s) to input a float value in C#?

34. Which is/are the correct method(s) to input a float value in C#?

  1. Parse(Console.ReadLine())
  2. ToSingle(Console.ReadLine())
  3. ToFloat(Console.ReadLine());
  4. Both A and B
  5. Both A and C

Answer: B) Both A and B

Explanation:

In C#, the following methods can be used to input a float value:

float.Parse(Console.ReadLine());
Convert.ToSingle(Console.ReadLine());

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.