예제 #1
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;
            }
        }
예제 #2
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;
            }
        }
예제 #3
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;
            }
        }
예제 #4
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;
            }
        }