MinMax

mail@pastecode.io avatar
unknown
csharp
a year ago
1.1 kB
1
Indexable
Never
Даниел Йорданов
10:03 ч. (преди 55 минути)
до мен

internal class Program

    {
        static void Main(string[] args)
        {
            int[] arrNum = new int[10];
            int max = int.MinValue;
            int maximumPosition = -1;
            int min = int.MaxValue;
            int minimumPosition = -1;
            for (int i = 0; i < arrNum.Length; i++)
            {
                arrNum[i] = int.Parse(Console.ReadLine());
            }
            for (int i = 0; i < arrNum.Length; i++)
            {
                if (arrNum[i] > max)
                {
                    max = arrNum[i];
                    maximumPosition = i;
                }
                if (arrNum[i] < min)
                {
                    min = arrNum[i];
                    minimumPosition = i;
                }
            }
            Console.WriteLine($"MAX: {max}; Position: {maximumPosition}");
            Console.WriteLine($"MIN: {min}; Position: {minimumPosition}");
        }
    }
}