PROGRAM TO CALCULATE SUBJECT AND STUDENT WISE TOTALS

/*PROGRAM TO CALCULATE SUBJECT AND STUDENT WISE TOTALS*/
#include<stdio.h>
#include<conio.h>
void main()
{
struct student
{
int s1,s2,s3,s4;
int t;
}s[5];
int i;
clrscr();
for(i=1;i<=5;i++)
{
printf(“Enter marks of %d student in all the four
subjects:\n”,i);
scanf(“%d%d%d%d”,&s[i].s1,&s[i].s2,&s[i].s3,&s[i].s4);
}
printf(“Marks obtained by each student are:\n”);
for(i=1;i<=5;i++)
{
s[i].t=s[i].s1+s[i].s2+s[i].s3+s[i].s4;
printf(“Marks obtained by %d student are::\n”,i);
printf(“Marks in first subject: %d\n”,s[i].s1);
printf(“Marks in second subject: %d\n”,s[i].s2);
printf(“Marks in third subject: %d\n”,s[i].s3);
printf(“Marks in fourth subject: %d\n”,s[i].s4);
printf(“Total marks are: %d\n”,s[i].t);
}
getch();
}

Leave a Reply

Your email address will not be published. Required fields are marked *