//从一个整数数组中取出最大值,最小值,计算总和,平均值。

        int max = 0;
        int small = 0;
        int sum = 0;
        
        int[] aa = { 80, 55, 72, 41, 95 };

        for (int i = 0; i < 4; i++)
        {
            if (aa[i] < aa[i + 1])
            {
                max = aa[i + 1];      //取最大值
            }

            if (aa[i] < aa[i + 1])
            {
                small = aa[i];        //取最小值
            }

            sum = sum + aa[i];

        }

        float  avg = sum / 5f;
        Console.WriteLine("数组的值为:");
        foreach (var item in aa)
        {
            Console.Write(item + "  " + "\t");
        }

        Console.WriteLine("\n最大值为{0},最小值为{1},总和为{2},平均值为{3}。", max, small, sum, avg);
        Console.ReadKey();