Code to accept the information of 5 students and display the information of first 3 students......
Code:
#include<stdio.h>
main()
{
struct stud
{
char name[20];
int rollno;
float per;
char grade;
};
struct stud s[5];
int i;
printf("enter the information of 5 students\n");
for(i=0;i<=4;i++)
{
scanf("%c%d%",&s[i].name,&s[i].rollno);
scanf("%f%c%",&s[i].per,&s[i].grade);
}
printf("the information of first three students is\n");
for(i=0;i<=2;i++)
{
printf("%c%d%\n",s[i].name,s[i].rollno);
printf("%f%c%",s[i].per,s[i].grade);
}
getch();
}