-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod.c_29.c
45 lines (29 loc) · 956 Bytes
/
mod.c_29.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//Write a program of structure employee that provides the following information -print and display empno, empname, address and age
#include <stdio.h>
#include <string.h>
struct employee {
int empno;
char empname[20];
char address[50];
int age;
};
int main() {
struct employee emp[3];
emp[0].empno = 101;
strcpy(emp[0].empname, "alka");
strcpy(emp[0].address, "123 Main Street,surat");
emp[0].age = 25;
emp[1].empno = 102;
strcpy(emp[1].empname, "Bharat");
strcpy(emp[1].address, "45 Park Avenue,vapi");
emp[1].age = 30;
emp[2].empno = 103;
strcpy(emp[2].empname, "gopal");
strcpy(emp[2].address, "7 Green vally,surat");
emp[2].age = 35;
printf("EmpNo\tEmpName\tAddress\t\t\t\t\t\tAge\n");
for (int i = 0; i < 3; i++) {
printf("%d\t\t%s\t%s\t\t\t%d\n", emp[i].empno, emp[i].empname, emp[i].address, emp[i].age);
}
return 0;
}