Console.WriteLine("Enter number:");
if(int.TryParse(Console.ReadLine(),out int input))
{
  // Input validated
  Console.WriteLine($"You entered {input}");
}
Comments