-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprac7_7.c
More file actions
51 lines (49 loc) · 1.34 KB
/
prac7_7.c
File metadata and controls
51 lines (49 loc) · 1.34 KB
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
50
51
//函数功能:输入时间计算工资,所交税,纯收入;
#include<stdio.h>
//宏定义后面不能加分号
#define BASIC 10
#define EXTRAM 1.5
#define FORETAX 0.15
#define NEXTTAX 0.2
#define LASTTAX 0.25
int main()
{
float hours,salary,tax;
printf("please enter your work hours :\n");
scanf("%f",&hours);
if (hours<=40)
{
salary=hours*BASIC;
printf("your salary is %f\n",salary);
if (salary<=300)
{
tax=salary*FORETAX;
printf("you need pay tax is %f\n",tax);
printf("your income is %f\n",salary-tax);
}
else
{
tax=(salary-300)*NEXTTAX;
printf("you need pay tax is %f\n",45+tax);
printf("your income is %f\n",salary-tax-45);
}
}
else
{
salary=(hours-40)*EXTRAM+400;
printf("your salary is %f\n",salary);
if (salary<=450)
{
tax=45+(salary-300)*NEXTTAX;
printf("you need pay tax is %f\n",tax);
printf("your incone is %f\n",salary-tax);
}
else
{
tax=75+(salary-450)*LASTTAX;
printf("you need pay tax is %f\n",tax);
printf("your incone is %f\n",salary-tax);
}
}
return 0;
}