static void Main(string[] args) { int[] a = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,0,11}; int max; int min; int xxa=ax((a),out max, out min); Console.WriteLine("最大值{0}",max); Console.WriteLine("最小值{0}",min); Console.ReadKey(); } public static int ax(int[] xx, out int max, out int min) { int xxa = 0; max = xx[0]; min = xx[0]; for (int i = 0; i < xx.Length; i++) { if (max < xx[i]) { max = xx[i]; } if (min > xx[i]) { min = xx[i]; } } return xxa; }
时间: 2024-10-28 11:22:12