1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-12-03 17:26:21 +00:00
202401-programming-assignments/【实践课外】2.选择结构1/7-2 21选择-个人所得税.c

52 lines
1.0 KiB
C
Raw Normal View History

2024-10-18 10:46:44 +00:00
#include <stdio.h>
int main() {
double n, ans = 0;
scanf("%lf", &n);
if (0 < n && n < 36000) {
ans += 0.03 * n;
} else if (n >= 36000) {
ans += 0.03 * 36000;
}
if (36000 <= n && n < 144000) {
ans += 0.1 * (n - 36000);
} else if (n >= 144000) {
ans += 0.1 * (144000 - 36000);
}
if (144000 <= n && n < 300000) {
ans += 0.2 * (n - 144000);
} else if (n >= 300000) {
ans += 0.2 * (300000 - 144000);
}
if (300000 <= n && n < 420000) {
ans += 0.25 * (n - 300000);
} else if (n >= 420000) {
ans += 0.25 * (420000 - 300000);
}
if (420000 <= n && n < 660000) {
ans += 0.3 * (n - 420000);
} else if (n >= 660000) {
ans += 0.3 * (660000 - 420000);
}
if (660000 <= n && n < 960000) {
ans += 0.35 * (n - 660000);
} else if (n >= 960000) {
ans += 0.35 * (960000 - 660000);
}
if (960000 <= n) {
ans += 0.45 * (n - 960000);
}
printf("%.2lf\n", ans);
return 0;
}