2016年c#算平均分

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace consoleapplication1
{
    class Program
    {
        static void Main(string[] args)
        {          int[] grade = new int[10];
            for (int i = 0; i < 10; i++)
            {
                string s;
                s = Console.ReadLine();
                grade[i] = int.Parse(s);
            }
            int max = grade[0];
            int min = grade[0];
            int sum = 0;
            for (int i = 0; i < 10; i++)
            {
                if (max < grade[i])
                {
                    max = grade[i];
                }
                if (min > grade[i])
                {
                    min = grade[i];
                }
                sum = grade[i] + sum;
            }
            Console.WriteLine("平均分为:" + (double)sum / 10);
            Console.ReadKey();
        
        }
    }
}

你可能感兴趣的:(c#)