qq_半城浮华_0
2024-02-01 11:09
using System;
using System.Collections.Generic;
using System.Text;
namespace projAboveAvg
{
class Program
{
static void Main(string[] args)
{
int avg = 0;
int sum = 0;
int[] scores=new int[8]{90,65,88,70,46,81,100,68};
string[] names= new string[8]{"景珍","林惠祥","成蓉","洪南昌","龙玉民","单江开","田武山","王三明"};
foreach(int x in scores){
sum+=x;
}
avg=sum/(names.Length);
Console.Write("平均分是{0},高于平均分的有:",avg);
for(int i=0;i<scores.Length;i++){
if(scores[i]>avg){
Console.Write(names[i]);
}
}
}
}
}
Console.Write("平均分是{0},高于平均分的有:",avg) Writer后要加Line,进行换行,输出格式才能与标准答案一致!
C#开发轻松入门
254117 学习 · 1459 问题
相似问题