예제 #1
0
        public static void RunFindSquareRoots()
        {
            int a = -1, b = 2, c = 3;

            if (a != 0)
            {
                double[] result = HomeWork1.FindSquareRoots(a, b, c, out double discriminant);


                if (discriminant < 0)
                {
                    Console.WriteLine($"Уравнение не имеет корней, дискриминант равен {discriminant}");
                }
                else if (discriminant == 0)
                {
                    Console.WriteLine($"Уравнение имеет один корень : {result[0]} и дискриминант {discriminant}");
                }
                else if (discriminant > 0)
                {
                    Console.WriteLine($"Уравнение имеет два корня : {result[0]} и {result[1]} и дискриминант {discriminant} ");
                }
            }
            else
            {
                Console.WriteLine("Уравнение не имеет решения!");
            }
        }
예제 #2
0
        public static void RunDotPosition()
        {
            int result = HomeWork1.DotPosition(5, 5);

            if (result == 0)
            {
                Console.WriteLine($"Точка лежит на оси координат!");
            }
            else if (result == 1)
            {
                Console.WriteLine($"Точка лежит в I квадранте!");
            }
            else if (result == 2)
            {
                Console.WriteLine($"Точка лежит в II квадранте!");
            }
            else if (result == 3)
            {
                Console.WriteLine($"Точка лежит в III квадранте!");
            }
            else if (result == 4)
            {
                Console.WriteLine($"Точка лежит в IV квадранте!");
            }
        }
예제 #3
0
        public static void RunValueYOfX()
        {
            int min = -5, max = 5, step = 3;

            double[,] arr = HomeWork1.ValueYOfX(min, max, step);
            for (int i = 0; i < arr.GetLength(0); i++)
            {
                Console.WriteLine($"Значение функции y = -0.23x^2 + x от x: {arr[i, 0]} равно {arr[i, 1]}");
            }
        }
예제 #4
0
        public static void RunStraightLineEquation()
        {
            int[] result = HomeWork1.StraightLineEquation(2, 0, 0, 2);

            if (result[1] < 0)
            {
                Console.WriteLine($"уравнение прямой : y = {result[0]}x  {result[1]}");
            }
            else if (result[0] == 0)
            {
                Console.WriteLine($"уравнение прямой : y = {result[1]}");
            }
            else if (result[1] == 0)
            {
                Console.WriteLine($"уравнение прямой : y = {result[0]}x ");
            }
            else
            {
                Console.WriteLine($"уравнение прямой : y = {result[0]}x + {result[1]}");
            }
        }
예제 #5
0
        public static void RunIsTrueFirstDivideOnSecond()
        {
            int  firstNumber = 5, secondNumber = 2;
            bool result = HomeWork1.IsTrueFirstDivideOnSecond(firstNumber, secondNumber, out int[] arr);

            if (result == false && secondNumber == 0)
            {
                Console.WriteLine("На ноль делить нельзя!");
            }
            else if (result == true && secondNumber == firstNumber)
            {
                Console.WriteLine("Результатом деления двух равных чисел является: 1");
            }

            if (result == true && arr[1] == 0)
            {
                Console.WriteLine($"Число {firstNumber} делится на {secondNumber} без остатка. Результат деления: {arr[0]}");
            }
            else if (result == true && arr[1] != 0)
            {
                Console.WriteLine($"Число {firstNumber} делится на {secondNumber} c остатком. Результат деления: {arr[0]} в остатке {arr[1]}");
            }
        }
예제 #6
0
        public static void RunIsDotInsideOfCircle()
        {
            int result = HomeWork1.IsDotInsideOfCircle(-1, 7, 3);

            if (result == 0)
            {
                Console.WriteLine("Решения нет!");
            }
            else
            {
                if (result == 1)
                {
                    Console.WriteLine("Точка лежит в пределах окружности!!");
                }
                else if (result == 2)
                {
                    Console.WriteLine("Точка лежит не в пределах окружности!");
                }
                else if (result == 3)
                {
                    Console.WriteLine("Точка лежит на окружности!");
                }
            }
        }
예제 #7
0
 public static void RunIsTrueExpression()
 {
     int[] result = HomeWork1.IsTrueExpression(20);
     Console.WriteLine($"12) Решение доказано {result[0]} раз из 10, опровергнуто {result[1]} из 10");
 }
예제 #8
0
 public static void RunSumAndMultiOfNumber()
 {
     int[] arr = HomeWork1.SumAndMultiOfNumber(548965);
     Console.WriteLine($"11) Сумма {arr[0]}, произведение {arr[1]} ");
 }
예제 #9
0
 public static void RunFactorialOfNumber()
 {
     Console.WriteLine($"9) Факториал: {HomeWork1.FactorialOfNumber(5)}");
 }
예제 #10
0
 public static void RunMathResult()
 {
     Console.WriteLine($"5) Посчитать выражение: {HomeWork1.MathResult(15, 0, 2)}");
 }
예제 #11
0
 public static void RunLengthOfHypo()
 {
     Console.WriteLine($"2) Длина гипотенузы: {HomeWork1.LengthOfHypo(5, 5)}");
 }
예제 #12
0
        } //  Задача 4. Игра

        #endregion


        #region Первая домашка

        public static void RunCalcCreditPayments()
        {
            double[] arr = HomeWork1.CalcCreditPayments(30000, 9, 30);
            Console.WriteLine($"{arr[0]}, {arr[1]}");
        }