C#数组的应用

来源:互联网 发布:机房网络交换机回收 编辑:程序博客网 时间:2024/06/06 19:31
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{    class Program    {        static void Main(string[] args)        {            int[,] stu=new int[5,4]{            {70,80,90,87},            {78,79,89,90},            {67,89,98,80},            {89,78,66,88},            {89,78,68,88}             };            double[] a = new double[5]{0,0,0,0,0};            for (int i = 0; i < 5; i++) {                for (int j = 0; j < 4; j++) {                    a[i] += stu[i,j];                }                a[i] = a[i] / 4;                Console.WriteLine("第"+i+"个学生的平均成绩为:"+a[i]);            }            Console.ReadKey();                    }    }}

0 0
原创粉丝点击