Пример #1
0
        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;
            }
        }
Пример #2
0
        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;
                }
                }
            }
        }
Пример #3
0
        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;
            }
        }
Пример #4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Please enter number to execute task!");
            int taskNumber = Convert.ToInt32(Console.ReadLine());

            switch (taskNumber)
            {
            case 1:
                Task1.PrintGreetings();
                Task1.PrintGreetings();
                Task1.PrintGreetings();
                break;

            case 2:
                Console.WriteLine("Please enter your Name: ");
                string name = Console.ReadLine();
                Console.WriteLine("Please enter your Last Name: ");
                string sureName = Console.ReadLine();

                Console.WriteLine("Hello Mr/ Mrs: ");
                Task2.PrintMyName(name, sureName);
                break;

            case 3:
                Task3.PrintNameSureName();
                break;

            case 4:

                Console.WriteLine("Please write your input Number");
                int number = Convert.ToInt32(Console.ReadLine());

                Console.WriteLine($"Factorial number from {number} is {Task5.Factorial(number)}");
                break;

            default:
                Console.WriteLine("Looks like number is out of task numbers range!");
                break;
            }
        }
Пример #5
0
        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;
            }
        }
Пример #6
0
        static void Main(string[] args)
        {
            Console.WriteLine("ievadi uzdevuma nr.");
            string inp = Console.ReadLine();

            Console.WriteLine("--------------------");

            switch (inp)
            {
            case "1":
                Task1.MultipleGreetings();
                //te varēja for ciklu
                break;

            case "2":
                Console.WriteLine("Ievadi vārdu: ");
                string name = Console.ReadLine();
                Console.WriteLine("Ievadi uzvārdu: ");
                string surname = Console.ReadLine();
                Task2.PrintMyName(name, surname);;
                break;

            case "3":
                Task3.PrintNameSurname();
                break;

            case "4":
                Console.WriteLine("Ievadi skaitli n: ");
                int n = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine($"Faktoriāls no {n} ir {Task4.Factorial(n)}");
                break;

            default:
                Console.WriteLine("Nr. neatbilst uzdevumu skaitam.");
                break;
            }
        }