using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Hello_World
{
    class Program
    {
        static void Main(string[] args)
        /* {
             Console.WriteLine("Hello World");
             Console.ReadLine();
           }

           {
             int[] a = new int[] { 15, 29, 8, 2, 32, 99, 6, 5 };
             Console.WriteLine("最大值为:{0}", a.Max());
             Console.WriteLine("最小值为:{0}", a.Min());
             Console.ReadLine();
          
            } */
        
            {
            int[] a = new int[] { 15, 29, 8, 2, 32, 99, 6, 5 };
            int max = a[0], min = a[0];
            for (int i = 1; i < 8; i++)
            {
                if (max < a[i])
                    max = a[i];
                if (min > a[i])
                    min = a[i];
            }
            Console.WriteLine("Max:{0},Min:{1}", max, min);
            Console.ReadLine();

            }
    }
}
posted on 2021-03-10 11:15  羲和i  阅读(77)  评论(0)    收藏  举报