WAP to take one structure name master that contain rollno, name and take another structure within master name is tran that contain 6 subject mark, get data from user and display rollno,name, 6 subject mark, total and percentage of 5 student.
Defination:: WAP to take one structure name master that contain rollno, name and take another structure within master name is tran that contain 6 subject mark, get data from user and display rollno,name, 6 subject mark, total and percentage of 5 student.
Source Code::
struct master
{
int no;
char na[10];
struct tran
{
int su[6];
int tot,per;
}t;
}m[5];
void main()
{
int i,j;
clrscr();
printf("enter rollno,name and marks\n");
for(i=0;i<=5;i++)
{
scanf("%d%s",&m[i].no,m[i].na);
printf("enter 6 sub marks:\n");
for(j=0;j<=5;j++)
{
scanf("%d",&m[i].t.su[j]);
m[i].t.tot=m[i].t.tot+m[i].t.su[i];
}
m[i].t.per=m[i].t.tot/6;
printf("\n");
}
for(i=0;i<=5;i++)
{
printf("\nrollno:%d\nname:%s\n",m[i].no,m[i].na);
for(j=0;j<=5;j++)
{
printf("\nmarks:%d\n",m[j].t.su[j]);
}
printf("\ntot:%d",m[i].t.tot);
printf("\nper:%d",m[i].t.per);
}
getch();
}
Source Code::
struct master
{
int no;
char na[10];
struct tran
{
int su[6];
int tot,per;
}t;
}m[5];
void main()
{
int i,j;
clrscr();
printf("enter rollno,name and marks\n");
for(i=0;i<=5;i++)
{
scanf("%d%s",&m[i].no,m[i].na);
printf("enter 6 sub marks:\n");
for(j=0;j<=5;j++)
{
scanf("%d",&m[i].t.su[j]);
m[i].t.tot=m[i].t.tot+m[i].t.su[i];
}
m[i].t.per=m[i].t.tot/6;
printf("\n");
}
for(i=0;i<=5;i++)
{
printf("\nrollno:%d\nname:%s\n",m[i].no,m[i].na);
for(j=0;j<=5;j++)
{
printf("\nmarks:%d\n",m[j].t.su[j]);
}
printf("\ntot:%d",m[i].t.tot);
printf("\nper:%d",m[i].t.per);
}
getch();
}
WAP to take one structure name master that contain rollno, name and take another structure within master name is tran that contain 6 subject mark, get data from user and display rollno,name, 6 subject mark, total and percentage of 5 student.
Reviewed by Unknown
on
21:29
Rating:
No comments: