static void Main(string[] args) { int number = 12; bool kkkk = Teht1.OnkoLuku(number); // ask number from the user (read one line) Console.Write("Give a number > "); string syote = Console.ReadLine(); // try to read number from the given line int number; bool result = int.TryParse(syote, out number); // number (integer) was given correctly, use it.. if (result) { Console.WriteLine("Number was " + number); } }
static void Main(string[] args) { Console.WriteLine("1.checknums 2.elevator 3.amplifier"); int selector = int.Parse(Console.ReadLine()); switch (selector) { case 1: Teht1 check = new Teht1(); check.CheckNumberMain(); break; case 2: Teht2 hissi = new Teht2(); hissi.ElevatorMain(); break; case 3: Teht3 amplifier = new Teht3(); amplifier.AmplifierMain(); break; } }