Why do you use structure ? Write a program to input teacher id, name, address and subject of 10 teachers and display them properly using structure.

Shra Wan
0


Why do you use structure ? 
Answer this question in Comment...

Write a program to input teacher id, name, address and subject of 10 teachers and display them properly using structure. 

#include<stdio.h>
struct teacher
{
int id;
char n[10], a[10], s[10];
};
struct teacher t[10];

int main( )
{
int i;
printf(“Enter teachers id, name, address and subject”);
for(i=1;i<=10;i++)
{
	scanf(“%d %s %s %s”, &t[i].id, t[i].n, t[I].a, t[i].s);
}
printf(“Entered data are:”);
for(i=1;i<=10;i++)
{
	printf(“%d %s %s %s”, t[i].id, t[i].n, t[i].a, t[i].s);
}
return 0;
}




Post a Comment

0Comments

Thank you very much for your comment.

Post a Comment (0)