Home > Back-end >  A small topic
A small topic

Time:10-01

In star grand prix, with 10 judges contestants score, score is 1 ~ 100 minutes, player final score is: remove the a and a minimum points after the rest of the eight grade average, please write a program to realize, (not see homework at the end of the article suggests)

Programming requirements: must be used for loop to achieve

Input: input ten number 1 ~ 100 (10 legal input data directly, subject shall not consider the legitimacy of the judgment data)

Output format: removes a high score: * * *, to remove a minimum points: * * *, the singer's final score is: * * * (final score reserved to two decimal places)

CodePudding user response:

For your reference
 
#include
# define N 10

Int main ()
{
Int arr [N].
Int I, j, nmax=0, nmin=0, sum=0;
Float avge=0.0;

For (I=0; I{
Printf (" please enter the first % d judges score: \ n ", I + 1);
The scanf (" % d ", & amp; Arr [I]);
}

Nmin=arr [0];
For (I=0; I{
The sum +=arr [I];
If (nmax & lt; Arr [I])
{
Nmax=arr [I];
}
If (nmin & gt; Arr [I])
{
Nmin=arr [I];
}
}

The sum -=(nmax + nmin);
Avge=(float) sum/8;
Printf (" removes a high % d, % d to remove a minimum points, and player. The final score % 2 f, \ n ", nmax, nmin, avge);

getchar();
return 0;

}
  • Related