DISPLAY 3 STUDENTS INFORMATION USING STRUCTURES

#include<stdio.h> #include<conio.h> struct student {             int rollno;                                          ...

#include<stdio.h>
#include<conio.h>
struct student
{
            int rollno;                                             
            char name[20];
            int maths,physics,computers;
            float tot;
};
main()
{
            int i;
            struct student st[3];
            clrscr();
            for(i=0;i < 3;i++)
            {
                         printf("ENTER STUDENT[%d]                                                                                                                          ROLLNO,NAME,MATHS,PHYSICS,COMPUTERS", i);
                        scanf("%d%s%d%d%d",&st[i].rollno,&st[i].name,
                        &st[i].maths,&st[i].physics,&st[i].computers);
            }
            for(i=0;i < 3;i++)
            {
                        st[i].tot= st[i].maths+st[i].physics+st[i].computers;
            }

            for(i=0; i< 3;i++)
            {
                                    printf("student[%d]details",i);
                                    printf("ROLLNO=%d \n NAME=%s \n MATHS=%d \n                                                           PHYSICS=%d \n COMPUTERS=%d \n                                                                                 TOTAL=%f\n",st[i].rollno,st[i].name,st[i].maths,st[i].physics,
                                    st[i].computers,st[i].tot);
             }
getch();
}

  

OUT PUT:

structures

Related

C Programs 2520614777688830149

Post a Comment

emo-but-icon

item