#include <stdio.h>int main() { int salary; double tax = 0.0; // 个人所得税额 printf("请输入您的工资:"); scanf("%d", &salary); int taxable = salary - 1600; // 应纳税所得额 if (taxable <= 0) { printf("您不需要缴纳个人所得税.\n"); } else if (taxable <= 500) { tax = taxable * 0.05; } else if (taxable <= 2000) { tax = 25 + (taxable - 500) * 0.1; } else if (taxable <= 5000) { tax = 175 + (taxable - 2000) * 0.15; } else if (taxable <= 20000) { tax = 625 + (taxable - 5000) * 0.2; } else if (taxable <= 40000) { tax = 3625 + (taxable - 20000) * 0.25; } else if (taxable <= 60000) { tax = 8625 + (taxable - 40000) * 0.3; } else if (taxable <= 80000) { tax = 14625 + (taxable - 60000) * 0.35; } else { tax = 21625 + (taxable - 80000) * 0.4; } printf("您的工资是%d元,应当缴纳个人所得税%.2f元.\n", salary, tax); return 0;}加长这段代码
时间: 2024-03-30 13:36:00 浏览: 50
#include <stdio.h>
int main() {
int salary;
double tax = 0.0; // 个人所得税额
printf("请输入您的工资:");
scanf("%d", &salary);
int taxable = salary - 1600; // 应纳税所得额
if (taxable <= 0) {
printf("您不需要缴纳个人所得税.\n");
} else if (taxable <= 500) {
tax = taxable * 0.05;
} else if (taxable <= 2000) {
tax = 25 + (taxable - 500) * 0.1;
} else if (taxable <= 5000) {
tax = 175 + (taxable - 2000) * 0.15;
} else if (taxable <= 20000) {
tax = 625 + (taxable - 5000) * 0.2;
} else if (taxable <= 40000) {
tax = 3625 + (taxable - 20000) * 0.25;
} else if (taxable <= 60000) {
tax = 8625 + (taxable - 40000) * 0.3;
} else if (taxable <= 80000) {
tax = 14625 + (taxable - 60000) * 0.35;
} else {
tax = 21625 + (taxable - 80000) * 0.4;
}
printf("您的工资是%d元,应当缴纳个人所得税%.2f元.\n", salary, tax);
// 计算实际到手工资
double actualSalary = salary - tax;
printf("扣除个人所得税后,您的实际到手工资为%.2f元.\n", actualSalary);
// 计算平均每月税后工资
double avgSalary = actualSalary / 12;
printf("您的平均每月税后工资为%.2f元.\n", avgSalary);
// 输出个人所得税的税率和速算扣除数
if (taxable <= 500) {
printf("税率为5%%,速算扣除数为0元.\n");
} else if (taxable <= 2000) {
printf("税率为10%%,速算扣除数为25元.\n");
} else if (taxable <= 5000) {
printf("税率为15%%,速算扣除数为175元.\n");
} else if (taxable <= 20000) {
printf("税率为20%%,速算扣除数为625元.\n");
} else if (taxable <= 40000) {
printf("税率为25%%,速算扣除数为3625元.\n");
} else if (taxable <= 60000) {
printf("税率为30%%,速算扣除数为8625元.\n");
} else if (taxable <= 80000) {
printf("税率为35%%,速算扣除数为14625元.\n");
} else {
printf("税率为40%%,速算扣除数为21625元.\n");
}
return 0;
}
阅读全文