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

How would I code this in C programming? NOT C++ Just C programming. Also, if pos

ID: 3810743 • Letter: H

Question

How would I code this in C programming? NOT C++ Just C programming. Also, if possible, I would appreciate a screenshot of the code with how it looks compiled to make things easier and to copy and paste the code text when you reply here. Please complete all of the tasks listed in the bullet points. Thank you.

Goals 1. Create a program that calculates the highest, lowest, and average grade using an array Tasks Write code that asks the user to enter 5 grades, stores them in an array, and calculates the following statistics on the grade: Use #define to set the number of grades to 5 Ask the user to enter a grade. Store each grade in an array. Repeat 5 times. Scan through the array of grades and find the highest and lowest of all the grades. Display to the user. Scan through the array of grades and find the *median grade (the grade right in the middle if they're ordered lowest to highest Display to the user Make sure that your code compiles and runs successfully Submit your main.c C code via Blackboard An example run of the program is shown in the table below Enter a grade: 100 Enter a grade: 80 Enter a grade: 95 Enter a grade 60 Enter a grade: 90 Highest grade 100 Lowest grade 60 Median grade 90

Explanation / Answer

Code:-

#include <stdio.h>

#define NO_OF_GRADE 5

int main(void) {
   int arr[NO_OF_GRADE];
   int i;
   int j;
   int min=0;
   int max=0;
   for(i=0;i<NO_OF_GRADE;i++){
        printf("ENTER a grade : ");
        scanf("%d",&arr[i]);
        if(arr[i]>max)
            max=arr[i];
       if(i==0)
            min=arr[i];
        if(arr[i]<min)
            min=arr[i];
   }
   int temp;
   int median=(0+5)/2;
   for (i = 0; i < NO_OF_GRADE; ++i)
    {
        for (j = i + 1; j < NO_OF_GRADE; ++j)
        {
            if (arr[i] > arr[j])
            {
                temp = arr[i];
                arr[i] = arr[j];
                arr[j] = temp;
            }
        }
    }
   printf("Highest Grade : %d ",max);
   printf("Lowest Grade : %d ",min);
   printf("Median Grade : %d ",arr[median]);
   return 0;
}

Output:-

ENTER a grade : 100

ENTER a grade :85

ENTER a grade :95

ENTER a grade :60

ENTER a grade :90

Highest Grade : 100
Lowest Grade : 60
Median Grade : 90

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