#include<stdio.h>
struct student
{
char name[100];
int rollno,sub1,sub2,sub3,sub4,sub5,sub6;
};
main()
{
struct student allstudent[100];
int n,i,max;
printf("\nEnter number of students=");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\nEnter name of student %d=",i+1);
scanf("%s",allstudent[i].name);
printf("\nEnter roll number of student %d=",i+1);
scanf("%d",&allstudent[i].rollno);
printf("\nEnter marks of student %d=",i+1);
printf("\nSubject 1=");
scanf("%d",&allstudent[i].sub1);
printf("\nSubject 2=");
scanf("%d",&allstudent[i].sub2);
printf("\nSubject 3=");
scanf("%d",&allstudent[i].sub3);
printf("\nSubject 4=");
scanf("%d",&allstudent[i].sub4);
printf("\nSubject 5=");
scanf("%d",&allstudent[i].sub5);
printf("\nSubject 6=");
scanf("%d",&allstudent[i].sub6);
}
printf("\nName\tRoll Number\tSubject 1\tSubject 2\tSubject 3\tSubject 4\tSubject 5\tSubject 6");
for(i=0;i<n;i++)
{
printf("\n%s",allstudent[i].name);
printf("\t\t%d",allstudent[i].rollno);
printf("\t\t%d",allstudent[i].sub1);
printf("\t\t%d",allstudent[i].sub2);
printf("\t\t%d",allstudent[i].sub3);
printf("\t\t%d",allstudent[i].sub4);
printf("\t\t%d",allstudent[i].sub5);
printf("\t\t%d\n",allstudent[i].sub6);
}
max=0;
for(i=1;i<n;i++)
{
if(allstudent[max].sub1<allstudent[i].sub1)
{
max=i;
}
}
printf("\nThe maximum mark in subject1");
printf("\nName=%s,Roll Number=%d,Mark=%d",allstudent[max].name,allstudent[max].rollno,allstudent[max].sub1);
max=0;
for(i=1;i<n;i++)
{
if(allstudent[max].sub2<allstudent[i].sub2)
{
max=i;
}
}
printf("\nThe maximum mark in subject2");
printf("\nName=%s,Roll Number=%d,Mark=%d",allstudent[max].name,allstudent[max].rollno,allstudent[max].sub2);
max=0;
for(i=1;i<n;i++)
{
if(allstudent[max].sub3<allstudent[i].sub3)
{
max=i;
}
}
printf("\nThe maximum mark in subject3");
printf("\nName=%s,Roll Number=%d,Mark=%d",allstudent[max].name,allstudent[max].rollno,allstudent[max].sub3);
max=0;
for(i=1;i<n;i++)
{
if(allstudent[max].sub4<allstudent[i].sub4)
{
max=i;
}
}
printf("\nThe maximum mark in subject4");
printf("\nName=%s,Roll Number=%d,Mark=%d",allstudent[max].name,allstudent[max].rollno,allstudent[max].sub4);
max=0;
for(i=1;i<n;i++)
{
if(allstudent[max].sub5<allstudent[i].sub5)
{
max=i;
}
}
printf("\nThe maximum mark in subject5");
printf("\nName=%s,Roll Number=%d,Mark=%d",allstudent[max].name,allstudent[max].rollno,allstudent[max].sub5);
max=0;
for(i=1;i<n;i++)
{
if(allstudent[max].sub6<allstudent[i].sub6)
{
max=i;
}
}
printf("\nThe maximum mark in subject6");
printf("\nName=%s,Roll Number=%d,Mark=%d",allstudent[max].name,allstudent[max].rollno,allstudent[max].sub6);
}