Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write code in C to determine gold medal winner displaying full name and average

ID: 3707087 • Letter: W

Question


Write code in C to determine gold medal winner displaying full name and average score of winner using the following information. 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 ?ne line using the keyboard: 1. firstname lastname scorel score2 score3 score4 scores score6 The user should be instructed to separate each data element by at least one space. 2. The first and last name of each snowboarder should be read in and stored in separate arrays named firstnames and lastnames. (If you want to practice more with strings, you may want to explore how to read in and save the whole name at one time and save it in an array called names.) 3. 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.

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);

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote