by Dinesh Thakur Category: C Programming (Pratical)

This is C program that asks user to find out the highest marks and average of students. Here declaring required variables for storing the value. User declares an array type variable in this user puts the value static up to 10 element. Using clear screen method user also uses the loop statement for vary the condition for average and marks into it. And a control statement also use for getting the condition true. if (mark[i] > highest) then the highest marks will be in mark[i]. 

Then finding out the average of students on the base of marks. In the end to display result on the screen.

Problem statement:

This is C program that asks user to find out the highest marks and the average.

  1. Declaring the variables.
  2. Using conditions.
  3. Using method for average calculating.
  4. Display result on the screen.

This is C program to find out highest marks and average. Output of this program shown below. 

#include <stdio.h>

int main ()
{
        float mark[10] = {45.6, 78.4, 65.9, 58.3, 82.1, 44.5, 61.8, 53.6, 49.2, 37.7};
        int i;
        float sum = 0, average, highest = 0;
        clrscr();
        for (i = 0; i < 10; i++)
             {
                sum += mark[i];
                if (mark[i] > highest)
                        highest = mark[i];
             }
        average = sum / 10.0;
        printf("The Average Mark is %5.2f \n", average);
        printf("The Highest Mark is %5.2f \n", highest);
        getch();
        return 0;
}
Output :

C Program Find the Highest Marks and Average

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Search Content