Program 365: Total marks of all N Students for given subjects using Structures
//Coming Soon
Output:
#include<stdio.h>
struct Student{
char name[20];
int maths,physics,chemistry,total;
};
main()
{
int i,size;
printf("Enter number of students\n");
scanf("%d",&size);
Student s[size];
for(i=0;i<size;i++)
{
printf("Enter Student %d Name(max 20 characters)\n",i+1);
fflush(stdin);
gets(s[i].name);
printf("Enter %s's Maths marks: ",s[i].name);
scanf("%d",&s[i].maths);
printf("Enter %s's Physics marks: ",s[i].name);
scanf("%d",&s[i].physics);
printf("Enter %s's Chemistry marks: ",s[i].name);
scanf("%d",&s[i].chemistry);
s[i].total=s[i].maths+s[i].physics+s[i].chemistry;
printf("\n");
}
printf("Final Marks for All Students\n");
for(i=0;i<size;i++)
{
printf("Total Marks of %s=%d\n",s[i].name,s[i].total);
}
}
Explanation://Coming Soon
Output:


