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]);
时间: 2024-10-15 12:44:49