i need to write a code in c with the following instructions Assume that each jud
ID: 3702035 • Letter: I
Question
i need to write a code in c with the following instructions
Assume that each judge’s score is an integer. For each of 3 snowboarders (will a loop be helpful with this?), you will be prompting the user to enter the following data on one line using the keyboard:
firstname lastname score1 score2 score3 score4 score5 score6
The user should be instructed to separate each data element by at least one space.
The first and last name of each snowboarder should be read in and stored in separate arrays named firstnames and lastnames.
A loop should be used to read in and save scores for each snowboarder into an array of integers named scores. The snowboarder with the highest floating point average of four scores (see description above to understand which four scores) is the winner of the gold medal.
Complete the Problem Description, Input, Output, and Assumptions sections of a Lab Report. Decide on the tasks necessary for applying the rules to determine the gold medal winner.
Include in the Example section of your lab report an example worked by hand, using the following sample data below (with a pretend mix of male/female USA athletes).
Name
Six judges’ scores
Avg (excluding min score and max score )
Sean White
96
98
88
99
98
100
97.75
Chloe Kim
92
99
100
98
99
97
98.25
Ben Ferguson
90
95
91
85
94
88
90.75
Write the code to determine the average score for each competitor. For each snowboarder, display a message stating the person’s whole name and the average of that snowboarder’s four scores. This will help verify that your program works correctly for each person.
Finally, write the code to determine the gold medal-winning score. Display a
Explanation / Answer
coding in c language:
#include <stdio.h>
void main()
{
char firstname[20],lastname[20];
int score[5];int i,j,k;
float sum[10],average[10],high;
for(i=0;i<3;i++)
{
printf("firstname lastname score1 score2 score3 score4 score5 score6 ");
scanf("%s %s ",&firstname,&lastname);
for(j=0;j<=5;j++)
{
scanf("%d ",&score[j]);
sum[i]+=score[j];
}
average[i]=sum[i]/6;
printf("%f ",average[i]);
}
high = average[0];
for (k=1;k<=3;k++)
{
if (high < average[k])
high = average[k];
}
printf(" the gold medal score is : %f", high);
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.