#include<stdio.h>
struct employee
{
int id,age,salary;
char name[25];
}emp[100];
void main()
{
int i,n;
printf("Enter the no of employees\n");
scanf("%d",&n);
printf("Enter employee info as id , name , age , salary\n");
for(i=0;i<n;i++)
{
scanf("%d %s %d %d",&emp[i].id,emp[i].name,&emp[i].age,&emp[i].salary);
}
printf("\nEMP_NAME\tEMP_NAME\tEMP_AGE\t\tEMP_SAL\n");
for(i=0;i<n;i++)
{
printf("%d\t\t%s\t\t%d\t\t%d\n",emp[i].id,emp[i].name,emp[i].age,emp[i].salary);
}
}
Output
Enter the no of employees
2
Enter employee info as id , name , age , salary
1
Raman
25
80000
2
Rahul
24
90000
EMP_NAME EMP_NAME EMP_AGE EMP_SAL
1 Raman 25 80000
2 Rahul 24 90000