1. 程式人生 > >函式,取最大值

函式,取最大值

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