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

Write a program that declares a two-dimensional array of integer grades using: i

ID: 3775145 • Letter: W

Question

Write a program that declares a two-dimensional array of integer grades using: int gradesArray[students][exams] Then the program will do the following: Display the grades, average, minimum grade and maximum grade for each student in well-formatted table. Find and display the minimum and maximum for the entire array gradesArray. Find and display the standard deviation of the entire array gradesArray Display bar chart that represents the grades distribution A sample output for 10 students and 5 exams is shown below:

Explanation / Answer

#include <stdio.h>
#include <conio.h>

int main(){
    int exams,students,i,j,grade_max,grade_min,dist,var;
    int averageMarks[20],max[20],min[20],count[20];
    int gradesArray[20][20];
    float marks, total=0.0f;
    clrscr();


    printf("Enter number of students ");
    scanf("%d", &students);
    printf("Enter number of exams ");
    scanf("%d", &exams);

    for(i = 0; i < students; i++)
     {
      for(j = 0; j < exams; j++)
     {
printf("Enter the student %d marks of %d exam ",(i+1),(j+1) );
       scanf("%d", &gradesArray[i][j]);
     }
    }

   grade_max = gradesArray[0][0];
   grade_min = gradesArray[0][0];

   for(i = 0; i < students; i++)
     {
    total = 0;
    max[i] = gradesArray[i][0];
    min[i] = gradesArray[i][0];


      for(j = 0; j < exams; j++)
     {
total = total + gradesArray[i][j];

/* If current element of array is greater than max */
if( gradesArray[i][j]>max[i])
{
     max[i] = gradesArray[i][j];
}

/* If current element of array is smaller than min */
if( gradesArray[i][j]<min[i])
{
     min[i] = gradesArray[i][j];
}

   if(gradesArray[i][j]> grade_max)
    {
     grade_max= gradesArray[i][j];
    }

     if(gradesArray[i][j]< grade_min)
    {
       grade_min= gradesArray[i][j];
     }


     }
    averageMarks[i] = total / exams;

    }

    for(i = 0; i < students; i++)
   {
      printf("The student %d marks of exams are ",(i+1) );
      for(j = 0; j < exams; j++)
       {
printf("%d ",gradesArray[i][j] );
       }
       printf("Average Marks = %d ",averageMarks[i] );
       printf("Maximum Marks = %d ",max[i] );
      printf("Minimum Marks = %d ",min[i] );
      printf(" ");
    }

     printf("Maximum grades = %d ",grade_max );
      printf("Minimum grades = %d ",grade_min);


for(i=0;i<=11;i++)
{
count[i] = 0;
}


for(i = 0; i < students; i++)
   {
    for(j = 0; j < exams; j++)
     {
     switch(gradesArray[i][j]/10){
       case 10 :
      count[11]=count[11] + 1;
      break;
       case 9 :
      count[10]=count[10] + 1;
      break;
       case 8 :
      count[9]=count[9] + 1;
      break;
       case 7 :
      count[8]=count[8] + 1;
      break;
       case 6 :
      count[7]=count[7] + 1;
      break;
       case 5 :
      count[6]=count[6] + 1;
      break;
       case 4 :
      count[5]=count[5] + 1;
      break;
      case 3 :
      count[4]=count[4] + 1;
      break;
      case 2 :
      count[3]=count[3] + 1;
      break;
       case 1 :
      count[2]=count[2] + 1;
      break;
      case 0 :
      count[1]=count[1] + 1;
      break;

       default :
    /* Marks less than 0*/
    printf("Not valid input " );
   }
}
}

var=0;
for(i=1;i<=11;i++)
{
dist=count[i];

printf("%d - %d:   ",var,(var+9));
var=var +10;

for(j=0;j<dist;j++)
   {
   printf("*");
   }
printf(" ");
}


    getch();

    return 0;
}

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