Basic algorithm of C language 08-remove the highest score and remove the minimum score for averaging

Source: Internet
Author: User

//
/*
==================================================================
Title: Tryouts often use this method to find players score, remove a maximum score, remove a
Minimum score. Ask for average results!

Please implement this method of calculation programmatically.


==================================================================
*/
#include <stdio.h>
Main ()
{
float A[10],max,min,sum=0.0,aver;
int i;
printf ("Input score: \ n");
for (i=0;i<10;i++)
{
printf ("Score%2d:", i+1);
scanf ("%f", &a[i]);
if ((a[i]<0) | | | (A[I]&GT;10))
{
printf ("The score was entered incorrectly. , make sure the score is at 0-10. \n______________________________\n ");
I=-1;
}
}
MAX=A[0];MIN=A[0];
for (i=0;i<10;i++)
{
if (Max<a[i])
Max=a[i];
if (Min>a[i])
Min=a[i];
Sum=sum+a[i];
}
Aver= (sum-max-min)/8;
printf ("Remove a highest score:%.1f\n", Max);
printf ("Remove a minimum score:%.1f\n", Min);
printf ("Average score is:%.2f\n", aver);
}
/*
==================================================================
Comment: Define the number of judges (10). Enter score (number of a[]), Max and Min, sum
Sum Ask sum-highest score-lowest score, average.
==================================================================
*/




Basic algorithm of C language 08-remove the highest score and remove the minimum score for averaging

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.