# Thread: help on dropping score.

1. ## help on dropping score.

In a fruit-eating contest, there are 6 judges. Each judge gives a score out of 10 such as 7.5. The lowest
score is discarded and the remaining scores averaged to determine the final score. If the average if 9.0 or
above, the participant gets a golden raspberry.
Write a program that calculates and reports score as follows:

so far i have...

Code:
```#include <stdio.h>

int calcScore(void) {
const int judges = 6;
float score[judges-1], avg = 0, sum = 0;
static int compNo = 1;
int i;
printf("Enter %i scores for competitor #%i: ", judges, compNo);
for(i=-1; i<judges-1; i++) {
scanf("%f", &score[i]);
sum += score[i];
//printf("%.1f\n", sum);       // debugging line
}
printf("\n");
avg = sum / judges;
printf("Result for %i: %.1f\n", compNo, avg);

if(avg >= 9.0){
printf("You win a golden raspberry!\n");
}
printf("Another score? 1-yes, 0-no: ");
compNo += 1;
return 0;
}

int main(void) {
const int YES = 1;
calcScore();
//printf("calcScore ending...\n");  //debugging line

calcScore();
}
return 0;
}```

any help would be greatly appreciated. i'm having trouble figuring in where to put the drop lowest score and what not.

2. Sample Run (user input in italics)
For competitor 1 enter 6 scores: 4 5 6 7 8 9
Result for competitor 1 is 7.00
Another score? (1=Yes 0=No) 1
For competitor 2 enter 6 scores: 9.5 9.5 9.5 9.5 9.5 9.5
Result for competitor 2 is 9.50 Golden raspberry
Another score? (1=Yes 0=No) 1
For competitor 3 enter 6 scores: 0 0 0 0 0 0
Result for competitor 3 is 0.00
Another score? (1=Yes 0=No) 0

1. You can't access score[-1] -- you'll have to start your loop at 0.
2. You can't drop the lowest score until you have them all; and you have to drop the lowest score before you print the averages. That rather limits where you can put that.
3. I don't know that you've thought out your while loop quite carefully enough. Compare what gets printed to how the loop works.

3. i'm sorry. i'm kind of new to this and i'm not quite sure what you're saying. i agree that i'm not too good at thinking about my loops before i write them, but i was confused as to how to accept 6 scores and drop the lowest one in just a few lines of code.

4. Well, how would you know which is the smallest score? Suppose I have six numbers written on index cards, and I show them to you one at a time. You also have a single sticky note which is just big enough to write one number down (you can write a second one down, but you'll have to erase the first). How would you figure out which score to drop?