练习1:从一个整数数组中取出最大的整数
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace 练习
{
class Program
{
static void Main(string[] args)
{
//从一个整数数组中取出最大的整数
int[] numbers = { 3, 5, 6, 37, 19, 98, 65, 34, 54, 43 };
int max = numbers[0];
int min = numbers[0];
for (int i = 0; i < numbers.Length; i++)
{
if (numbers[i] > max)
{
max = numbers[i];
}
if (numbers[i] < min)
{
min = numbers[i];
}
}
Console.WriteLine("max={0},max={1}", max, min);
Console.ReadKey();
}
}
}