函数,取最大值

using System;

namespace C取最大值
{
    class Program
    {
        static int Max(int[] array){
            int  max=array[0];
            for (int i = 1; i < array.Length ; i++) {
                if(array[i]>max){
                    max=array[i];
                }
            }
            return max;
        }
        public static void Main(string[] args)
        {
            int[]array={23,3434,435,4543,435,43,345,34,435,5,43,45};
            Console.WriteLine(Max(array));
            // TODO: Implement Functionality Here
            
            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
        }
    }
}

 

posted @ 2018-10-20 18:24  逐梦武威  阅读(419)  评论(0编辑  收藏  举报