-
Notifications
You must be signed in to change notification settings - Fork 0
/
26.txt
43 lines (39 loc) · 998 Bytes
/
26.txt
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>
#include <stdlib.h>
#include<string.h>
typedef struct{
char name[30];
int id;
double salary;
} Employee;
int main()
{
int n;
printf("Please neter the number of employee.\n");
scanf("%d",&n);
Employee employees[n];
printf("Enter %d Employee Details \n \n",n);
for(int i=0; i<n; i++){
printf("Employee %d:- \n",i+1);
printf("Name: ");
fflush(stdin);
scanf("%[^\n]s",employees[i].name);
printf("Id: ");
fflush(stdin);
scanf("%d",&employees[i].id);
printf("Salary: ");
fflush(stdin);
scanf("%lf",&employees[i].salary);
char ch = getchar();
printf("\n");
}
for(int i=0; i<n; i++){
printf("Name \t: ");
printf("%s \n",employees[i].name);
printf("Id \t: ");
printf("%d \n",employees[i].id);
printf("Salary \t: ");
printf("%.2lf \n",employees[i].salary);
printf("\n");
}
}