C#定义一个数组,并输出最大值和最小值

如题所述

int[] a = new[] { 4, 7, 6, 9, 3, 1, 5, 8, 0 };
List<int> b = new List<int>(a);
b.Sort(delegate(int x, int y) { return (y - x); });

最大值:b[0]
最小值:b[b.Count-1]
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答