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.

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.

Source Code::

struct master
{
    int no;
    char na[10];
    struct tran
    {
        int su[6];
        int tot,per;
    }t;
}m;

void main()
{
    int i;
    clrscr();
    printf("enter any no and name:\n");
    scanf("%d%s",&m.no,m.na);

    m.t.tot=0;
    printf("enter 6 sub marks:\n");
    for(i=0;i<=5;i++)
    {
        scanf("%d",&m.t.su[i]);
        m.t.tot=m.t.tot+m.t.su[i];
    }
    m.t.per=m.t.tot/6;
    printf("\nid:%d\nname:%s",m.no,m.na);

    printf("\n\n\n");
    for(i=0;i<=5;i++)
    {
        printf("%d",m.t.su[i]);
        printf("\n");
    }
    printf("\ntot:%d\nper:%d\n",m.t.tot,m.t.per);

    printf("class:");
    if(m.t.per>=70)
    {
        printf("distction");
    }
    else if(m.t.per>=60)
    {
        printf("first");
    }
    else if(m.t.per>=50)
    {
        printf("second");
    }
    else if(m.t.per>=40)
    {
        printf("pass");
    }
    else
    {
        printf("fail");
    }
    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. 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. Reviewed by Unknown on 21:28 Rating: 5

No comments:

Powered by Blogger.