Exercise 3-4 student achievement statistics (15 points)

This question requires the preparation of program reads N percentile scores of students, the statistical distribution of a five-point performance. Percentile scores to the results of a five-point conversion rules:

  • A greater than or equal to 90 divided;
  • Less than 90 and greater than or equal to B 80;
  • Greater than or equal to 80 and less than 70 are C;
  • Less than 70 and greater than or equal to 60 D;
  • 60 is less than E.

Input formats:

In the first line input is given a positive integer N ( ≤1000), i.e., the number of students; given in the second row of the N th percentile score students, separated by a space therebetween.

Output formats:

The number of output A, B, C, D, E corresponding to the five-point distribution results in a row, separated by a space between the numbers, end of line can not have extra space.

Sample input:

7
77 54 92 73 60 65 69
 

Sample output:

1 0 2 3 1


#include <stdio.h>
int main(){
    int n,i,score;
    int A=0,B=0,C=0,D=0,E=0;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        Scanf ( " % D " , & Score); // IF IF the else in square brackets each have 
        IF (Score> = 90 )
        {
            A++;
        }
        else if(score<90&&score>=80)
        {
            B++;
        }
        else if(score<80&&score>=70)
        {
            C++;
        }
        else if(score<70&&score>=60)
        {
            D++;
        }
        else if(score<60)
        {
            E++;
        }
    }
    printf("%d %d %d %d %d",A,B,C,D,E);
    return 0;}

 

Guess you like

Origin www.cnblogs.com/Kimsohyun/p/12578892.html