10个数,输出最大值,最小值,平均值
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace shuixianshu
{
class Program
{
static void Main(string[] args)
{
int[] a=new int [10];
int i;
double sum = 0;
int max=a[0];
int min=a[0];
for (i = 0; i <a.Length; i++)
{
Console.WriteLine("请输入第{0}个数字",i);
a[i] = Convert.ToInt32(Console.ReadLine());
sum += a[i];
if (max < a[i])
max = a[i];
if (min > a[i])
min = a[i];
}
double avr;
avr = Convert.ToDouble( sum / a.Length);
Console.WriteLine("最大值{0},最小值{1},平均值{2}",max,min,avr);
Console.ReadKey();
}
}
}