如题,在线等》》

解决方案 »

  1.   

    int[] a = new []{};
    //放数组里边
    int max = a[0]
    for(int i = 1; i<a.Length;i++)
    {
    if(max<a[i])
    {
    max = a[i];
    }
    }
    max就是最大值了
      

  2.   

     用linq
    int[] my = {1, 2, 3, 4};
                int number = my.Max();
      

  3.   

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                int[] numbers = new int[] { 1, 2, 3, 4, 5,9,8,7,6 };
                Console.WriteLine(numbers.Max());
                Console.ReadLine();        }
        }
    }