📄 program.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
namespace Example9_10 {
class Program {
static void Main(string[] args) {
//定义程序中用到的变量,用scores数组存储分数,另外两个双精度变量存储总分和平均分。
double[] scores = new double[10] { 80, 75, 89, 92, 64, 73, 53, 96, 74, 88 };
double all = 0.0;
double average = 0.0;
foreach (double score in scores) {
//输出数组中的原始成绩。
Console.WriteLine("原始分数:{0}", score);
//累加分数
all += score;
}
//求平均值
average = all / 10;
Console.WriteLine("平均成绩为:{0}", average);
Console.ReadLine();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -