static void Main(string[] args) { int taskNumber; while (true) { Console.Write("Enter the number of task you want to check (0 - exit): "); if (Int32.TryParse(Console.ReadLine(), out taskNumber)) { switch (taskNumber) { case 0: return; case 1: Part1.DoIt("input.txt", "output.txt"); break; case 2: Part2.DoIt(); break; case 3: Part3.DoIt(); break; default: Console.WriteLine("Incorrect task number"); break; } } else { Console.WriteLine("Can not resolve the task number"); } } }