Count the students ' scores and calculate the number of people below the average
The program code is as follows:
1 /*2 March 9, 2017 11:51:283 function: Count the students ' scores and calculate the number of people below the average4 */5#include"stdio.h"6 intMain (void)7 {8 inti =0, J;9 intscore;Ten floatsum =0.0, aver =0.0; One intm =0, k =0; A inta[ -]; - intb[ -]; - the - while(printf ("Please enter the student's score, when entering negative numbers, end the input:")) - { -scanf ("%d",&score); +a[i++] =score; -m++; + if(Score <=0) A Break; at } - -M-=1;//when entering data, the last data will participate in the calculation, M-=1; The purpose of the statement is to not let the last data participate in the calculation - - for(j =0; J < M; J + +) -Sum + =A[j]; in -aver = SUM/m; to + for(j =0; J < M; J + +) - { the if(Aver >A[j]) *b[k++] =A[j]; $ }Panax Notoginseng -printf ("Please output the number of students in this fractional segment:%d\n", k); the + for(j =0; J < K; J + +) Aprintf ("%d", B[j]); theprintf"\ n"); + - return 0; $ } $ /* - Summary: - results shown in vc++6.0: the —————————————————— - Please enter the student's score, when entering negative numbers, end input: TenWuyi Please enter the student's score, when entering negative numbers, end input: the Please enter the student's score, when entering negative, end input: - Please enter a student's score, when entering negative numbers, end input: Wu Please enter a student's score, when entering negative numbers, end input: - Please enter the student's score, when entering negative, end input: About Please enter a student's score, when entering a negative number, end input: $ Please enter the student's score, when entering negative, end input: - Please enter the student's score, when entering negative, end input: - Please enter a student's score, when entering negative numbers, end input: 1 - Please output the number of students in this fractional segment: 4 A Ten + —————————————————— the */
C Language Code Programming questions Summary: Statistics students ' scores, calculate the number of people below average