c语言个税计算器2018
时间: 2023-07-28 15:08:16 浏览: 150
以下是一个简单的 C 语言个税计算器,可以计算 2018 年的个人所得税:
```c
#include <stdio.h>
int main() {
float income, tax;
printf("请输入您的税前收入:\n");
scanf("%f", &income);
if (income <= 0) {
printf("输入错误,请重新输入!\n");
return 0;
}
float threshold = 3500; // 起征点
float social_security = 0; // 社保公积金等五险一金
float taxable_income = income - threshold - social_security; // 应纳税所得额
if (taxable_income <= 0) {
tax = 0;
} else if (taxable_income <= 1500) {
tax = taxable_income * 0.03;
} else if (taxable_income <= 4500) {
tax = taxable_income * 0.1 - 105;
} else if (taxable_income <= 9000) {
tax = taxable_income * 0.2 - 555;
} else if (taxable_income <= 35000) {
tax = taxable_income * 0.25 - 1005;
} else if (taxable_income <= 55000) {
tax = taxable_income * 0.3 - 2755;
} else if (taxable_income <= 80000) {
tax = taxable_income * 0.35 - 5505;
} else {
tax = taxable_income * 0.45 - 13505;
}
printf("您的税前收入为:%.2f 元\n", income);
printf("您应缴纳的个人所得税为:%.2f 元\n", tax);
return 0;
}
```
注:该计算器只是一个简单的示例,实际应用中还需要考虑更多的因素,如社保公积金等五险一金的扣除、专项附加扣除等。
阅读全文