static void Main(string[] args) { Console.Write("Ievadiet uzdevuma nr.: "); int taskNr = Convert.ToInt32(Console.ReadLine()); switch (taskNr) { case 1: Task1.PrintGreeting(3); break; case 2: Task2.PrintMyName("Mārtiņš", "Atauga"); break; case 3: Task3.PrintNameSurname(Task3.GetNameSurname()); break; case 4: Console.WriteLine("Ievadiet skaitli n:"); int n = Convert.ToInt32(Console.ReadLine()); Console.WriteLine($"Faktoriāls no {n} ir { Task4.Factorial(n)} "); break; default: Console.WriteLine("Such task does not exist!"); break; } }
static void Main(string[] args) { Console.OutputEncoding = Encoding.UTF8; bool check = false; while (!check) { Console.Write("Lūdzu. ievadiet veselo skaitļi no 1 līdz 3, vai extra, lai izpildīt attiecīgo uzdevumu \n" + " (exit, lai izietu no programmas): "); switch (Console.ReadLine().Trim()) { case "1": { Task1.PrintGreeting(); Task1.PrintGreeting(); Task1.PrintGreeting(); break; } case "2": { Console.Write("Lūdzu, ievadiet vārdu: "); string name = Console.ReadLine(); Console.Write("Lūdzu, ievadiet uzvārdu: "); string surName = Console.ReadLine(); Console.WriteLine(); Task2.PrintMyName(name, surName); break; } case "3": { Task3.PrintNameSurname(Task3.GetNameSurname()); break; } case "extra": { Day6Extra.NotCicle(); break; } case "exit": { check = true; break; } default: { Console.WriteLine("Lūdzu evadiet pareizo ciparu vai vardu!!!"); break; } } } }
static void Main(string[] args) { Console.WriteLine("Ievadi uzdevuma nr. vai exit, lai iziet no programmas."); // asdsad string taskNr = Console.ReadLine(); switch (taskNr.Trim()) { case "1": for (int i = 0; i < 6; i++) { Task1.PrintGreeting(); // izpildīt 3 reizes } break; case "2": Console.Write("Ievadi vārdu: "); string name = Console.ReadLine(); Console.Write("Ievadi uzvārdu: "); string surname = Console.ReadLine(); Task2.PrintMyName(name, surname); break; case "3": Task3.PrintNameSurname(Task3.GetNameSurname()); break; case "extra": Console.Write("Ievadi skatili n: "); int n = Convert.ToInt32(Console.ReadLine()); Console.WriteLine($"Faktoriāls no {n} ir { ExtraTask.Factorial(n) }"); break; case "exit": return; default: Console.WriteLine($"Uzdevums '{ taskNr.Trim() }' neeksistē!"); break; } }
static void Main(string[] args) { Console.WriteLine("Ievadi uzdevuma nr.: "); string userInput = Console.ReadLine(); int x = Convert.ToInt32(userInput); switch (x) { case 1: Task1.PrintGreeting(); Task1.PrintGreeting(); Task1.PrintGreeting(); //for(int i = 0; i < 3; i++) break; case 2: string name = "Pārsla"; string surname = "Ēberliņa"; Task2.PrintMyName(name, surname); break; case 3: string nameSurname = Task3.GetNameSurname(); Task3.PrintNameSurname(nameSurname); break; case 4: Console.Write("Ievadi skaitli n: "); int n = Convert.ToInt32(Console.ReadLine()); Console.WriteLine($"Faktoriāls no {n} ir {Task4.Factorial(n)}"); break; default: Console.WriteLine("Ievadi skatli robežās no 1 līdz 4!"); break; } }