-
Notifications
You must be signed in to change notification settings - Fork 0
/
breakconti.c
49 lines (44 loc) · 1.24 KB
/
breakconti.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
46
47
48
49
#include <stdio.h>
struct employee{
int emp_id;
char emp_name[20];
int emp_gross_pay;
int emp_loan_choice;
union {
int housing_loan;
int education_loan;
int personal_loan;
};
};
int main() {
struct employee s;
scanf("%d\n",&s.emp_id);
scanf("%s\n",s.emp_name);
scanf("%d\n",&s.emp_gross_pay);
scanf("%d",&s.emp_loan_choice);
if(s.emp_loan_choice==1){
printf("%d\n",s.emp_id);
printf("%s\n",s.emp_name);
printf("%d\n",s.emp_gross_pay);
printf("Housing loan\n");
s.housing_loan = (s.emp_gross_pay*25*10)/100;
printf("%d",s.housing_loan);
}else if(s.emp_loan_choice==2){
printf("%d\n",s.emp_id);
printf("%s\n",s.emp_name);
printf("%d\n",s.emp_gross_pay);
printf("Education loan\n");
s.education_loan = (s.emp_gross_pay*15*10)/100;
printf("%d",s.education_loan);
}else if(s.emp_loan_choice==3){
printf("%d\n",s.emp_id);
printf("%s\n",s.emp_name);
printf("%d\n",s.emp_gross_pay);
printf("Personal loan\n");
s.personal_loan = (s.emp_gross_pay*10*10)/100;
printf("%d",s.personal_loan);
}else{
printf("Invalid input");
}
return 0;
}