string input = Console.ReadLine(); int number = 0; if (int.TryParse(input,out number)) { Console.Write(number); } else { Console.Write("Input Error"); }