Maha

Maha

  • NA
  • 0
  • 326.5k

Read()

Jul 10 2013 9:10 AM
This program is given in the following website:
http://www.dotnetperls.com/console-read

According to code while ((result = Console.Read()) != 0) program must end when input is 0, but it is not ending. Please explain the reason. Problem is highlighted.

using System;

class Program
{
static void Main()
{
int result;

while ((result = Console.Read()) != 0)
{
Console.WriteLine("{0} = {1}", result, (char)result);
}

Console.ReadKey();
}
}


Answers (7)