This question requires a program to read the scores of N students on a 100-point scale, and to calculate the distribution of scores on a 5-point scale. Conversion rules from 100-point results to 5-point results:
- Greater than or equal to 90 points A;
- Less than 90 and greater than or equal to 80 is B;
- Less than 80 and greater than or equal to 70 is C;
- Less than 70 and greater than or equal to 60 is D;
- Less than 60 is E.
Input format:
The input gives a positive integer N ( ≤1000) in the first line , that is, the number of students; the second line gives the percentage scores of N students, separated by spaces.
Output format:
The number of people who output the five-point scores corresponding to A, B, C, D, and E in one line is separated by spaces.
Sample input:
7
77 54 92 73 60 65 69
Sample output:
1 0 2 3 1
#include<stdio.h>
int main ()
{
int n;
int x=0,b=0,c=0,d=0,e=0;
scanf("%d",&n);
if(n>0&&n<=1000)
{
int a[n],i;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
if(a[i]>=90)
{
x++;
}else if(a[i]>=80)
{
b++;
}else if(a[i]>=70)
{
c++;
}else if(a[i]>=60)
{
d++;
}else
{
e++;
}
}
printf("%d %d %d %d %d",x,b,c,d,e);
}
return 0;
}