根据中国现行的个人所得税计算规则(截至2023年),个人所得税按月度收入分级计算,有一定的免征额(每月5000元),并按照七档税率进行累进税率计算。
中国个人所得税税率如下(单位:人民币):
税率 | 全月应纳税所得额 (元) | 速算扣除数 (元) |
---|---|---|
3% | 0 - 3,000 | 0 |
10% | 3,000 - 12,000 | 210 |
20% | 12,000 - 25,000 | 1,410 |
25% | 25,000 - 35,000 | 2,660 |
30% | 35,000 - 55,000 | 4,410 |
35% | 55,000 - 80,000 | 7,160 |
45% | 80,000 以上 | 15,160 |
注意:以上数据可能会有变化,请确保使用的是最新的税率和扣除标准。
程序实现如下:
#include <stdio.h>
// 定义税率和对应的级距
typedef struct {
float rate;
float quick_deduction;
} TaxBracket;
TaxBracket tax_brackets[] = {
{0.03, 0},
{0.10, 2520},
{0.20, 16920},
{0.25, 31920},
{0.30, 52920},
{0.35, 85920},
{0.45, 181920}
};
// 计算税前收入对应的税额
float calculate_tax(float taxable_income) {
float tax = 0.0;
if (taxable_income <= 0) {
return 0.0;
} else if (taxable_income <= 36000) {
tax = taxable_income * tax_brackets[0].rate - tax_brackets[0].quick_deduction;
} else if (taxable_income <= 144000) {
tax = taxable_income * tax_brackets[1].rate - tax_brackets[1].quick_deduction;
} else if (taxable_income <= 300000) {
tax = taxable_income * tax_brackets[2].rate - tax_brackets[2].quick_deduction;
} else if (taxable_income <= 420000) {
tax = taxable_income * tax_brackets[3].rate - tax_brackets[3].quick_deduction;
} else if (taxable_income <= 660000) {
tax = taxable_income * tax_brackets[4].rate - tax_brackets[4].quick_deduction;
} else if (taxable_income <= 960000) {
tax = taxable_income * tax_brackets[5].rate - tax_brackets[5].quick_deduction;
} else {
tax = taxable_income * tax_brackets[6].rate - tax_brackets[6].quick_deduction;
}
return tax;
}
int main() {
float pre_tax_income, social_insurance, taxable_income, tax, after_tax_income;
printf("请输入税前工资(元): ");
scanf("%f", &pre_tax_income);
// 假设五险一金为税前工资的11%,具体比例可根据实际情况调整
social_insurance = pre_tax_income * 0.11;
// 计算应纳税所得额
taxable_income = pre_tax_income - social_insurance - 5000;
// 计算个人所得税
tax = calculate_tax(taxable_income);
// 计算税后工资
after_tax_income = pre_tax_income - social_insurance - tax;
printf("税前工资: %.2f 元\n", pre_tax_income);
printf("扣除五险一金: %.2f 元\n", social_insurance);
printf("应纳税所得额: %.2f 元\n", taxable_income);
printf("个人所得税: %.2f 元\n", tax);
printf("税后工资: %.2f 元\n", after_tax_income);
return 0;
}
说明:
1. 输入税前工资:用户输入税前工资。
2. 计算五险一金:假设五险一金为税前工资的11%,具体比例可以根据实际情况调整。
3. 计算应纳税所得额:从税前工资中减去五险一金和每月5000元的免征额,得到应纳税所得额。
4. 计算个人所得税:根据应纳税所得额,按照中国个人所得税的累进税率计算税额。
5. 计算税后工资:从税前工资中减去五险一金和个人所得税,得到税后工资。
程序简化了实际计算中的一些细节,如各种专项扣除和不同城市的社保比例等,可以根据具体情况进一步完善。