第26讲—项目5—个人所得税计算器

来源:互联网 发布:windows专业版激活码 编辑:程序博客网 时间:2024/05/22 18:03
/** Copyright (c) 2015, CSDN学院* All rights reserved.* 文件名称:re.c* 作    者:刘树* 完成日期:2015年 4 月 16 日* 版 本 号:v1.0* 输入个人月收入总额,计算出他本月应缴税款和税后收入*/#include <stdio.h>  int main(){double dSalary, dTax = 0, dNetIncome = 0,t;printf("请输入您本月的收入总额(元):");scanf_s("%lf", &dSalary);t = dSalary - 3500;switch ((t>0)+(t > 1500) + (t > 4500) + (t > 9000) + (t > 35000) + (t > 55000) + (t > 80000)) //分段计算dTax{case 0:dTax = 0;break;case 1:dTax = 0.03*t;break;case 2:dTax = 0.1*t - 105;break;case 3:dTax = 0.2*t - 555;break;case 4:dTax = 0.25*t - 1005;break;case 5:dTax = 0.3*t - 2755;break;case 6:dTax = 0.35*t - 5505;break;case 7:dTax = 0.45*t - 13505;break;}dNetIncome = dSalary - dTax;    //计算税后收入printf("您本月应缴个人所和税 %.2lf 元,税后收入是 %.2lf 元。\n", dTax, dNetIncome);printf("依法纳税,共享繁荣。谢谢使用!\n");return 0;}


运行结果


0 0