HOME

Thursday, March 19, 2015

C PROGRAM TO TAKE NAME, ROLL NO AND MARK OF 5 STUDENT AND DISPLAY IT USING ARRAY IN STRUCTURE

#include<stdio.h>
#include<conio.h>
struct student
{
    char name[20];
    int roll;
    int mark;
};
void main()
{
    struct student a[5];
    int i;
    for(i=0;i<5;i++)
    {
        printf("enter name %d, roll no and marks\n",i+1);
        scanf("%s%d%d",a[i].name,&a[i].roll,&a[i].mark);
    }
    printf("the data you have entered are:\n");
    printf("name\troll no\tmark\n");
    for(i=0;i<5;i++)
    {
        printf("%s\t%d\t%d\n",a[i].name,a[i].roll,a[i].mark);
    }

}

No comments:

Post a Comment