-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLab3(1).c
More file actions
43 lines (37 loc) · 811 Bytes
/
Lab3(1).c
File metadata and controls
43 lines (37 loc) · 811 Bytes
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
#include<stdio.h>
struct employee{
char name[10];
int age;
char sex[6];
float salary;
}emp[5];
Message(char s[20],int count)
{
int i;
printf("\n------- %s -------\n",s);
for(i=1;i<=count;i++)
printf("-");
printf("\n");
}
main()
{
int i;
system("color f4");
Message("Input Data ",26);
for(i=0;i<5;i++){
printf("\n\n===== Data %d =====\n",i+1);
printf("Employee name : ");
scanf("%s",emp[i].name);
printf("Age : ");
scanf("%d",&emp[i].age);
printf("Sex : ");
scanf(" %s",emp[i].sex);
printf("Salary : ");
scanf("%f",&emp[i].salary);
}
Message("Output Data ",26);
printf("id\tName\tAge\tSex\tSalary\n");
for(i=0;i<5;i++){
printf("%d\t%s\t%d\t%s\t%.2f\n",i+1,emp[i].name,emp[i].age,emp[i].sex,emp[i].salary);
}
}