Home »
MCQs »
C# MCQs
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#?
- Parse(Console.ReadLine())
- ToSingle(Console.ReadLine())
- ToFloat(Console.ReadLine());
- Both A and B
- 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());