-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshui.c
71 lines (67 loc) · 1.81 KB
/
shui.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*************************************************************************
> File Name: shui.c
> Author:
> Mail:
> Created Time: Wed 17 Feb 2016 06:12:20 PM PST
************************************************************************/
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int salary, shebao, gongjijin;
printf("Please input you salary: \n");
scanf("%d", &salary);
printf("Please input you shebao: \n");
scanf("%d", &shebao);
printf("Please input you gongjijin: \n");
scanf("%d", &gongjijin);
int need = 0;
need = salary - (shebao + gongjijin) - 3500;
printf("need = %d\n", need);
int need_tmp = need;
double shui = 0.0;
while(need_tmp)
{
if (need_tmp > 80000)
{
shui += (need_tmp - 80000 ) * 0.45;
need_tmp = 80000;
}
else if (need_tmp > 55000)
{
shui += (need_tmp - 55000 ) * 0.35;
need_tmp = 55000;
}
else if (need_tmp > 35000)
{
shui += (need_tmp - 35000 ) * 0.30;
need_tmp = 35000;
}
else if (need_tmp > 9000)
{
shui += (need_tmp - 9000 ) * 0.25;
need_tmp = 9000;
}
else if (need_tmp > 4500)
{
shui += (need_tmp - 4500 ) * 0.20;
printf("shui = %f\n", shui);
need_tmp = 4500;
}
else if (need_tmp > 1500)
{
shui += (need_tmp - 1500 ) * 0.10;
printf("shui = %f\n", shui);
need_tmp = 1500;
}
else
{
shui += need_tmp * 0.03;
printf("shui = %f\n", shui);
need_tmp = 0;
}
}
printf("shui = %f\n", shui);
double real = salary - shebao - gongjijin - shui;
printf("read = %f\n", real);
}