Friday, October 14, 2011

Define the structure called CLASS having properties like stud_id, stud_name and stud_branch. Write a program which takes the details of at least 15 students.

main()
{
int i,n;
struct {
char stud_id[30];
char stud_name[30];
char stud_branch[30];
}
class[50];
printf("\nHow many students details would you want in the class(enter 15<) :\t");
scanf("%d",&n);
for(i=0;i {
printf("\n\nEnter student id:\t");
scanf("%s",class[i].stud_id);
printf("Enter student name:\t");
scanf("%s",class[i].stud_name);
printf("Enter student branch:\t");
scanf("%s",class[i].stud_branch);
}
printf("\n\n");
for(i=0;i {
printf("student id :\t\t %s\n",class[i].stud_id);
printf("student name :\t\t %s\n",class[i].stud_name);
printf("student branch :\t %s\n\n\n",class[i].stud_branch);
}
}

No comments:

Post a Comment