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

plese can anyone help me with this. i am trying to Write a program that will ask

ID: 3769648 • Letter: P

Question

plese can anyone help me with this.

i am trying to Write a program that will ask the user to enter 4 quiz scores for 3 students. and fined the lowest quiz grade and drop it out when I calculate the average.Also to display all 4 quiz scores for each student as well as the lowest score and the average.

i used this Functions:

- int findMin(int student, int scores[3][4])

o Finds the minimum quiz score for any given student

o Returns the minimum

- void printTable(int scores[3][4], int min[3], int avg[3])

o Prints the output to the screen

- float getAverage(int student, int min, int scores[3][4])

o finds the average of the 3 quiz scores for a given student

• ignores the minimum score

o returns the average

this what i have write:

#include <stdio.h>

int findMin(int student, int scores[3][4]){

int i;

int min=scores[student][0];

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

{

if(scores[student][i]<=min)

min= scores[student][i];

}

return min;

}

float getAverage(int student, int min, int scores[3][4])

{

float tot=0.0;

int i;

float average;

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

{

tot=tot+scores[student][i];

}

tot=tot-min;

average=tot/3.0;

return average;

}

void printTable(int scores[3][4], int min[3], float avg[3])

{

int i,j;

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

{

for(j=0;j<4;j++)

{

}

}

}

int main()

{

int q1,q2,q3,q4;

printf("Enter scoure for first sdudent: ");

scanf("%d",&q1);

scanf("%d",&q2);

scanf("%d",&q3);

scanf("%d",&q4);

printf("Enter scoure for secound sdudent: ");

scanf("%d",&q1);

scanf("%d",&q2);

scanf("%d",&q3);

scanf("%d",&q4);

printf("Enter scoure for thirde sdudent: ");

scanf("%d",&q1);

scanf("%d",&q2);

scanf("%d",&q3);

scanf("%d",&q4);

int scores[3][4];

int i,j;

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

{

for(j=0;j<4;j++)

{

  

scanf("%d",& scores[i][j]);

}

  

}

int min[3];

float avg[3];

for(i=0;i<3;i++) {

min[i]=findMin(i, scores);

avg[i]=getAverage(i, min[i],scores);

  

  

}

printTable(scores, min, avg);

return 0;

}

Explanation / Answer

There were few mistakes in the main function. I corrected them.

code:

#include <stdio.h>
int findMin(int student, int scores[3][4]){
int i;
int min=scores[student][0];
for(i=0 ;i<4;i++)
{
if(scores[student][i]<=min)
min= scores[student][i];

}

return min;

}
float getAverage(int student, int min, int scores[3][4])
{
float tot=0.0;
int i;
float average;
for(i=0 ;i<4;i++)
{
tot=tot+scores[student][i];

}
tot=tot-min;
average=tot/3.0;
return average;
}


void printTable(int scores[3][4], int min[3], float avg[3])
{
int i,j;
for(i=0;i<3;i++){
for(j=0;j<4;j++){
  
}
}


}
int main(){
   int scores[3][4];
printf("Enter score for first sdudent: ");
int j=0;
for(j=0;j<4;j++){
scanf("%d",& scores[0][j]);
}

printf("Enter score for second sdudent: ");
j=0;
for(j=0;j<4;j++){
scanf("%d",& scores[1][j]);
}
printf("Enter score for third sdudent: ");
j=0;
for(j=0;j<4;j++){
scanf("%d",& scores[2][j]);
}
int min[3];
float avg[3];
    int i=0;
for(i=0;i<3;i++) {
min[i]=findMin(i, scores);
avg[i]=getAverage(i, min[i],scores);
}
printTable(scores, min, avg);
return 0;
}