Esempio n. 1
0
        public static void Laba_4_1(int[] arr)
        {
            var temp = new MyStruct[arr.Length];

            for (int i = 0; i < arr.Length; i++)
            {
                for (int j = i + 1; j < arr.Length; j++)
                {
                    temp[i].proizv = arr[i] * arr[j];
                    temp[i].a      = arr[i];
                    temp[i].b      = arr[j];
                }
            }

            var min = temp.OrderBy(a => a.proizv).First();
            var max = temp.OrderByDescending(a => a.proizv).First();

            Console.WriteLine("{0}*{1}={2}", min.a, min.b, min.proizv);
            Console.WriteLine("{0}*{1}={2}", max.a, max.b, max.proizv);
        }