码迷,mamicode.com
首页 > 其他好文 > 详细

函数,取最大值

时间:2018-10-20 19:56:47      阅读:147      评论:0      收藏:0      [点我收藏+]

标签:void   class   space   todo   color   i++   line   oid   int   

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);
        }
    }
}

 

函数,取最大值

标签:void   class   space   todo   color   i++   line   oid   int   

原文地址:https://www.cnblogs.com/llhhcc/p/9822525.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!