C program to store and diaplay records of N employees using union.

#include<stdio.h>
#include<conio.h>
#include<string.h>
#define N 5
union employee{
int eid;
char ename[50];
char des[25];
char gender;
float salary;
};
void main() {
int i;
union employee e[N];
for (i=0;i<N;i++){
clrscr();
printf("Enter %d employee identification number:-\n",i+1);
scanf("%d",&e[i].eid);
getch();
}
for (i=0;i<N;i++) {
clrscr();
printf("\n Employee ID of %d employee =%d",e[i].eid);
getch();
}
}

No comments:

Post a Comment