输入十个学生的成绩,判断及格不及格人数,得到不及格人的学号

int[] xs = new int[10];
int [] cj=new int [3];


for (int i=0;i<10 ;i++ )
{
Console.Write("请输入{0}号学生的成绩:",i+1);
xs[i] = Convert.ToInt32(Console.ReadLine());
if (xs[i]<60&&xs[i]>=0)
{
cj[0]++;
}
else if(xs[i]>=60&&xs[i]<80)
{

cj[1]++;
}
else if (xs[i]<=100&&xs[i]>=80)
{
cj[2]++;
}


}

for (int i=0;i<10 ;i++ )
{
if(xs[i]<60)
{
Console.WriteLine("不及格的学生为{0}",xs[i]+1);
}

}


Console.WriteLine("不及格人数为{0},及格人数为{1},优秀人数为{2}。",cj[0],cj[1],cj[2]);

原文地址:https://www.cnblogs.com/zzc134680/p/5411155.html