int index = 0;
for (int i = 0; i < score.Length; i++)
{
if (score[i] >avg)
{
index = i;
Console.Write(name[index]);
Console.Write(" ");
}
}
for (int i = 0; i < score.Length; i++)
{
if (score[i] >avg)
{
index = i;
Console.Write(name[index]);
Console.Write(" ");
}
}
Console.Write("平均分是{0}",avg);
Console.WriteLine(", 高于平均分的有:");
Console.WriteLine(", 高于平均分的有:");
string[] name = {"景珍","林惠洋", "成蓉", "洪南昌", "龙玉民", "单江开", "田武山", "王三明" };
int[] score = {90,65,88,70,46,81,100,68};
int sum=0,avg;
foreach (int x in score)
{
sum += x;
}
avg = sum / score.Length;
int[] score = {90,65,88,70,46,81,100,68};
int sum=0,avg;
foreach (int x in score)
{
sum += x;
}
avg = sum / score.Length;
已采纳回答 / 慕粉3508730
【【【 { Console.WirteLine("有7的整倍数");}】】】 else {Console.WriteLine("没有7的整倍数"); }倒数第三行代码拼写错误,Write拼写成Wirte
2017-01-19
Console.WriteLine("我叫{0},是{1}生,今年{2}岁,身高{3}米。",name,sex,age,height);
字符串中用{0}~{3}表示将会输出4个变量的值,而四个变量依次写在字符串后面。
字符串中用{0}~{3}表示将会输出4个变量的值,而四个变量依次写在字符串后面。
2017-01-19
int year = 2015;//年份
string text;
int nian;
nian = year %= 4;
text = nian == 0 ? "闰年":"平年";//请填写代码
Console.WriteLine("今年是{0}", text);
%= 这个运算好想无法用于(int+string类型)中操作,可以打开vs试一试。。。
string text;
int nian;
nian = year %= 4;
text = nian == 0 ? "闰年":"平年";//请填写代码
Console.WriteLine("今年是{0}", text);
%= 这个运算好想无法用于(int+string类型)中操作,可以打开vs试一试。。。
2017-01-18
int year = 2015;//年份
int nian;
nian = year %= 4;
text = nian == 0 ? "闰年":"平年";//请填写代码
Console.WriteLine("今年是{0}", text);
int nian;
nian = year %= 4;
text = nian == 0 ? "闰年":"平年";//请填写代码
Console.WriteLine("今年是{0}", text);
2017-01-18