(c语言)本题目要求读入每月工资,计算按月需要累计缴纳的税额(税率见下图),此处只需显示应缴纳的税额,无需减去已缴纳部分。结果保留两位小数。 注意:每月有5000元免税额。 1.png
时间: 2024-06-13 16:06:40 浏览: 96
以下是C语言计算每月需要累计缴纳的税额的代码,结果保留两位小数:
```c
#include <stdio.h>
int main() {
float salary, tax;
scanf("%f", &salary);
salary -= 5000; // 减去免税额
if (salary <= 0) {
tax = 0;
} else if (salary <= 3000) {
tax = salary * 0.03;
} else if (salary <= 12000) {
tax = salary * 0.1 - 210;
} else if (salary <= 25000) {
tax = salary * 0.2 - 1410;
} else if (salary <= 35000) {
tax = salary * 0.25 - 2660;
} else if (salary <= 55000) {
tax = salary * 0.3 - 4410;
} else if (salary <= 80000) {
tax = salary * 0.35 - 7160;
} else {
tax = salary * 0.45 - 15160;
}
printf("%.2f", tax);
return 0;
}
```
阅读全文