WAP to take one structure name is student that contain rollno, name and 6 subject mark and display total, per and class.

Defination:: WAP to take one structure name is student that contain rollno, name and 6 subject mark and display total, per and class. 

Source Code::

struct student
{
    int no;
    char na[10];
    int su[6];
    int tot,per;
}s;

void main()
{
    int i;
    clrscr();
    printf("enter roll no,name:");
    scanf("%d%s",&s.no,s.na);

    printf("enter 6 subject marks:\n");

    s.tot=0;
    for(i=0;i<=5;i++)
    {
        scanf("%d",&s.su[i]);
        s.tot=s.tot+s.su[i];
    }
    s.per=s.tot/6;
    printf("\nrollno:%d\nname:%s\ntot:%d\nper:%d\n",s.no,s.na,s.tot,s.per);

    printf("class:");
    if(s.per>=70)
    {
        printf("distction");
    }
    else if(s.per>=60)
    {
        printf("first");
    }
    else if(s.per>=50)
    {
        printf("second");
    }
    else if(s.per>=40)
    {
        printf("pass");
    }
    else
    {
        printf("fail");
    }
    getch();
}
WAP to take one structure name is student that contain rollno, name and 6 subject mark and display total, per and class. WAP to take one structure name is student that contain rollno, name and 6 subject mark and display total, per and class. Reviewed by Unknown on 21:26 Rating: 5

No comments:

Powered by Blogger.