/* Program to
demonstrate array of structures */
#include<stdio.h>
#include<conio.h>
void
main()
{
struct marks
{
int sub1;
int sub2;
int sub3;
}s[5];
int i;
clrscr();
printf("Enter the marks of
students:\n");
for(i=0;i<5;i++)
{
printf("\nEnter marks of
Student-%d:",i+1);
scanf("%d%d%d",&s[i].sub1,&s[i].sub2,&s[i].sub3);
}
printf("\n\n Marks of
students:\n");
for(i=0;i<5;i++)
{
printf("\nStudent-%d:",i+1);
printf("%d\t%d\t%d",s[i].sub1,s[i].sub2,s[i].sub3);
}
getch();
}
OUTPUT
Enter
the marks of students:
Enter
marks of Student-1:74
80
69
Enter
marks of Student-2:65
70
81
Enter
marks of Student-3:92
88
84
Enter
marks of Student-4:78
80
80
Enter
marks of Student-5:86
76
90
Marks of students:
Student-1:74 80
69
Student-2:65 70
81
Student-3:92 88
84
Student-4:78 80
80
Student-5:86 76
90
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.