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

Answer this question using C program via Visual Studio program please. The follo

ID: 3824175 • Letter: A

Question

Answer this question using C program via Visual Studio program please.

The following shows ten students' information including student NO., name, and scores of three exams. Please write a program to: (1) create an array of structure; (2) input the data through keypad (3) print the following table one more column for average score: (4) find the student NO. and name with the highest average score. scorel score2 score 101 Joana 93 89 87 03 104 Jonathan 77 70 83 105 Vincent 70 67 60 106 Jennifer 99 97 95 88 89 108 Ryan 87 88 85 109 Trent 72 70 69 110 David 78 80 83

Explanation / Answer

Please see the screenshot of the source code and the output:

The code is pasted below along with the output, not able to attach screenshot due to technical issue.

#include <stdio.h>

// structure definition

struct stud

{

int NO;

char name[30];

int score1;

int score2;

int score3;

};

int main(int argc, const char * argv[]) {

  

// Declare an array of structure stud

struct stud student[10];

int i,pos = 0;

float average[10],high;

  

// Accept the data of 10 students from the user

for(i=0;i<10;i++)

{

printf(" Enter student NO:");

scanf("%d",&student[i].NO);

printf(" Enter student's name:");

scanf("%s",student[i].name);

printf(" Enter the score of exam 1:");

scanf("%d",&student[i].score1);

printf(" Enter the score of exam 2:");

scanf("%d",&student[i].score2);

printf(" Enter the score of exam 3:");

scanf("%d",&student[i].score3);

  

// calculate average

average[i] = (student[i].score1+student[i].score2+student[i].score3) / 3;

}

  

// Display student details

printf(" No name score1 score2 score3 average ");

for(i=0;i<10;i++)

{

printf(" %d %s %d %d %d %.2f",student[i].NO,student[i].name,student[i].score1,student[i].score2,student[i].score3,average[i]);

}

// find the higest abverage score

// assume average[0] is the highest average score

high = average[0];

  

// Loop through the remaining elements of array average to find the highest average

for(i=1;i<10;i++)

{

if(average[i] > high)

{

// store average[i] into high

high = average[i];

pos = i; // store the subscript of the highest average

}

}

printf("%d",i);

  

printf(" The highest average score details : student NO Name %d %s ",student[pos].NO,student[pos].name);

  

  

return 0;

}


output:

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