#include
void main()
{
struct student{int roll;
char name[20];
int marks;
}stud[5];
int i=0,no,flag=0;
char ch='y';
printf("\nEnter information of 20 student:-");
for(i=0;i<5;i++)
{printf("\nEnter the roll number of the student %d :-",i+1);
scanf("%d",& stud[i].roll);
printf("\n Enter the name of the student %d:-",i+1);
scanf("%s",& stud[i].name);
printf("\n Enter the marks of the student %d:-",i+1);
scanf("%d",& stud[i].marks);
}
while((ch=='Y')||(ch=='y'))
{clrscr();
printf("\nEnter student rollno to display:-\n");
scanf("%d",& no); flag=0;
for(i=0;i<5;i++)
{if(stud[i].roll==no)
printf("Roll Number:- %d Name:- %s Total Marks :- %d",stud[i].roll,stud[i].name,stud[i].marks);
flag=1;
}
if(flag==0)
printf("the Roll Number %d is not present in the list",no);
printf("\n Enter Y to continue");
printf("\n Enter any othr key to exit");
ch=getche();
}
}
No comments:
Post a Comment