C Language Code Programming questions Summary: Statistics students ' scores, calculate the number of people below average

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.