Friday, May 30, 2014

WRITE A PROGRAMME TO STORE INFORMATION OF N STUDENTS WHERE INFORMATION COMPRISES OF STUDENT'S NAME,SNO AND MARKS IN 4 SUBJECTS

#include<stdio.h>
#include<conio.h>
void main()
{
typedef struct student
{
int sno;
char name[20];
int submarks[4];
}stu;
stu s1[10];
int i,n,j;
clrscr();
printf("enter the no of students\n");
scanf("%d",&n);
printf("enter the details of students\n");
for(i=0;i<n;i++)
{
printf("enter sno and name\n");
scanf("%d%s",&s1[i].sno,s1[i].name);
printf("enter the marks in 4 subjects\n");
for(j=0;j<4;j++)
{
scanf("%d",&s1[i].submarks[j]);
}
}
printf("the details of students are\n");
for(i=0;i<n;i++)
{
printf("sno-%d name-%s\n",s1[i].sno,s1[i].name);
printf("the marks in 4 subjects\n");
for(j=0;j<4;j++)
{
printf("marks in %d subject is %d\n",j,s1[i].submarks[j]);
}
}
getch();
}

No comments:

Post a Comment