by Dinesh Thakur Category: C Programming (Pratical)

In this program, a structure (student) is created which contains name,subject and marks as its data member. Then, an array of structure of 10 elements is created. Then, data (name, sub and marks) for 10 elements is asked to user and stored in array of structure. Finally, the data entered by user is displayed.

Problem Statement:
The annual examination is conducted for 10 students for three subjects. Write a program to read the data and determine the following:
(a) Total marks obtained by each student.
(b) The highest marks in each subject and the marks. of the student who secured it.
(c) The student who obtained the highest total marks.
Here is source code of the C program to calculate The Marks and the grades of Students . The C program is successfully compiled. The program output is also shown below.

#include<stdio.h>
        struct student
        {
          int sub1;
          int sub2;
          int sub3;
        };
            void main()
        {
             struct student s[10];
             int i,total=0;
             clrscr();
             for(i=0;i<=2;i++)
                 {
                        printf("\nEnter Marks in Three Subjects = ");
                        scanf("%d%d%d",& s[i].sub1,&s[i].sub2,&s[i].sub3);
                        total=s[i].sub1+s[i].sub2+s[i].sub3;
                        printf("\nTotal marks of s[%d] Student= %d",i,total);
                 }
                        getch();
         }

Calculate Marks of 10 Students

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