static void SecondThreadTask(object param)
        {
            Thread.Sleep(100);
            MatrixParams p = (MatrixParams)param;

            double[,] A1 = { { 1, 1, 2 }, { 3, 2, 4 }, { 1, 2, 1 } };
            //SetMatrixRandom(p.size, p.randrng);
            Console.WriteLine("\nA1");
            PrintMatrix(A1);
            double[,] b1 = { { 4, 0, 0 }, { 4, 0, 0 }, { 1, 0, 0 } };
            //SetVectorasMatrixRandom(p.size, p.randrng);
            Console.WriteLine("\nb1");
            PrintMatrix(b1);
            Console.WriteLine("c1");
            double[,] c1 = { { 4, 0, 0 }, { 3, 0, 0 }, { 4, 0, 0 } };
            //SetVectorasMatrixRandom(p.size, p.randrng);
            PrintMatrix(c1);

            p.y2 = Mult(A1, Plus(b1, Mult(c1, 2)));
            Console.WriteLine("\nSecondThreadTask");
            PrintMatrix(p.y2);
            Console.WriteLine();
            PrintMatrix(Mult(p.y, Transpose <double>(p.y2)));
            p.D = Mult(Mult(p.y, p.y2), Transpose <double>(p.y2));
            Console.WriteLine("\n3333333333333333333");
            PrintMatrix(p.D);
            Thread.Sleep(600);
            p.B = Mult(Mult(p.Y32, p.y2), p.K1);
            Console.WriteLine("\n11111111111111111");
            PrintMatrix(p.B);
        }
        static void Main()
        {
            MatrixParams MP = new MatrixParams();


            Console.WriteLine("Натиснiть 1 щоб ввечти даннi вручу  ");
            Console.WriteLine("Натиснiть 2 щоб зарандомити даннi   ");
            int check = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine(check);
            if (check == 1)
            {
                MP.size             = Get_matrix_size();
                MP.check_input_type = true;
            }
            else
            {
                MP.size    = Get_matrix_size();
                MP.randrng = 5;
            }



            Thread Thread1 = new Thread(new ParameterizedThreadStart(FirstThreadTask));

            Thread1.Start(MP);

            Thread Thread2 = new Thread(new ParameterizedThreadStart(SecondThreadTask));

            Thread2.Start(MP);

            Thread Thread3 = new Thread(new ParameterizedThreadStart(ThirdThreadTask));

            Thread3.Start(MP);
        }
        static void ThirdThreadTask(object param)
        {
            Thread.Sleep(400);
            MatrixParams p = (MatrixParams)param;

            double[,] A2 = { { 4, 4, 3 }, { 1, 3, 3 }, { 3, 3, 2 } };
            //SetMatrixRandom(p.size, p.randrng);
            Console.WriteLine("\nA2");
            PrintMatrix(A2);
            double[,] B2 = { { 3, 1, 3 }, { 3, 1, 1 }, { 1, 2, 3 } };
            //SetMatrixRandom(p.size, p.randrng);
            Console.WriteLine("\nB2");
            PrintMatrix(B2);
            double[,] C2 = SetCMatrix(p.size);
            Console.WriteLine("\nC2");
            PrintMatrix(C2);
            p.Y3 = Mult(A2, Minus(C2, B2));
            Console.WriteLine("\nThirdThreadTask");
            PrintMatrix(p.Y3);
            p.Y32 = Mult(p.Y3, p.Y3);
            p.Y33 = Mult(p.Y32, p.Y3);
            Thread.Sleep(700);
            p.A = Mult(Mult(p.Y3, p.K1), Plus(p.y, p.y2));
            Console.WriteLine("\n222222222222222222");
            PrintMatrix(p.A);
        }
        static void FirstThreadTask(object param)
        {
            MatrixParams p = (MatrixParams)param;

            switch (p.check_input_type)
            {
            }
            double[,] A = { { 3, 4, 2 }, { 4, 4, 2 }, { 2, 4, 4 } };
            double[,] b = SetVectorBasMatrix(p.size);
            p.y         = Mult(A, b);
            Console.WriteLine("\nFirstThreadTask");
            PrintMatrix(p.y);
            Thread.Sleep(500);
            p.C = Mult(Mult(p.Y33, p.y), p.K2);
            Console.WriteLine("\n444444444444444");
            PrintMatrix(p.C);
            Thread.Sleep(1000);
            p.result = Plus(Plus(p.A, p.B), Plus(p.C, p.D));
            Console.WriteLine("\nFirstThreadTask");
            PrintMatrix(p.result);
        }