C语言代码,输入一个职工的月薪 salary,输出应交的个人所得税tax(保留2 位小数)。 tax = rate * (salary-3500) - deduction 当 salary <= 3500 时,rate = 0,deduction=0; 当 3500 < salary <= 5000时,rate = 3%,deduction=0; 当 5000 < salary <= 8000时,rate = 10%,deduction=105; 当 8000 < salary <=12500 时,rate =20%,deduction=555; 当 12500 < salary <= 38500 时,rate =25%,deduction=1005; 当 38500 < salary <=58500 时,rate =30%,deduction=2755; 当 58500 < salary <= 83500 时,rate =35%,deduction=5505; 当 83500 < salary 时,rate =45%,deduction=13505;
时间: 2023-06-17 19:08:23 浏览: 300
c语言计算个人所得税.txt
```c
#include <stdio.h>
int main() {
float salary, tax, rate, deduction;
scanf("%f", &salary);
if (salary <= 3500) {
rate = 0;
deduction = 0;
} else if (salary <= 5000) {
rate = 0.03;
deduction = 0;
} else if (salary <= 8000) {
rate = 0.1;
deduction = 105;
} else if (salary <= 12500) {
rate = 0.2;
deduction = 555;
} else if (salary <= 38500) {
rate = 0.25;
deduction = 1005;
} else if (salary <= 58500) {
rate = 0.3;
deduction = 2755;
} else if (salary <= 83500) {
rate = 0.35;
deduction = 5505;
} else {
rate = 0.45;
deduction = 13505;
}
tax = rate * (salary - 3500) - deduction;
printf("%.2f", tax);
return 0;
}
```
阅读全文