Examveda

What will be the output for following input from the console as a character?
static void Main(string[] args)
{
    Console.WriteLine("what is your name?");
    char s;
    s = Convert.ToChar(Console.ReadLine());
    Console.WriteLine("how are you: "+s);
    Console.Read();
}

A. Compile time error

B. Code run successfully prints nothing on console

C. Code runs successfully prints input on console

D. Run time error

Answer: Option D


Join The Discussion

Related Questions on File Handling and Input Output in C Sharp