You are on page 1of 2

#include<stdio.

h>
void main()
{
struct std
{
int marks[6];
int tot;
char reg[40];
char name[50];
}stud[60];
int i,j,n,temp;
struct std *p[60];
p=stud;
printf("\n Enter the students ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\n enter the name of student: ");
scanf("%s",p[i]->name);
printf("\n enter the register no:of student");
scanf("%s",p[i]->reg);

p[i]->tot=0;
for(j=0;j<6;j++)
{
printf("\n enter marks of sub %d :",j+1);
scanf("%d",&p[i]->marks[j]);
p[i]->tot=+p[i]->marks[j];
}
}

for(i=0;i,n;i++)
{
for(j=0;j<n-1;j++)
{
if(p[i]->tot<p[i+1]->tot)
{
temp=p[i]->tot;
p[i]->tot=p[i+1]->tot;
p[i+1]->tot=temp;
}
}
}
for(i=0;i<n;i++)
{
printf("\n name of student:%s ",p[i]->name);
printf("\n register no:%s",p[i]->reg);

printf("\n register no:of student",p[i]->reg );


for(j=0;j<6;j++)
{
printf("\n marks of sub %d is :%d",j+1,p[i]->marks[j]);
}
}
}

You might also like