Aravind Chitra

Aravind Chitra

  • NA
  • 11
  • 1.6k

c# programming doubt

Sep 28 2014 10:38 AM
hello all,
 
the following code is not working as expected
 
CODE
 
Console.WriteLine("enter alphabet");
int c = Console.Read();
Console.WriteLine(c);
Console.WriteLine("enter string");
string j = Console.ReadLine();
Console.WriteLine(j);
Console.ReadKey();
 
it doesn't allow to enter the string and just exits the program
 
but if code is reversed,it works fine
 
Console.WriteLine("enter string");
string j = Console.ReadLine();
Console.WriteLine(j);
Console.WriteLine("enter alphabet");
int c = Console.Read();
Console.WriteLine(c);
Console.ReadKey();
 
can anyone explain this??
 
 

Answers (13)