计算个人所得税

该程序用于计算个人所得税。根据输入的月薪,它应用不同的税率来计算税款,税率根据工资范围从0.0到0.2不等。示例输出显示了不同工资水平下的税额,表明程序能正确处理各种情况。
输入一个职工的月薪salary,输出应交的个人所得税tax(保留2位小数)。
tax = rate * (salary-850)
当 salary <= 850 时,rate = 0.0;
当 850 < salary <= 1350 时,
rate = 0.05;
当 1350 < salary <= 2850 时,
rate = 0.1;
当 2850 < salary <= 5850 时,
rate = 0.15;
当 salary > 5850时,rate = 0.2;
例:括号内是说明
输入 1010.87 输出 tax=8.04
输入 32098.76 输出 tax=6249.75
输入 800 输出 tax=0.00
输入 4010 输出 tax=474.00 
输入 2850 输出 tax=200.00 
#include <stdio.h>
int main()
{
    double  salary,rate,tax;
    scanf("%lf",&salary);

    if(salary<=850)
        rate = 0.0;
    if(850<salary &&salary<=1350)
        rate = 0.05;
    if(1350<salary&&salary<=2850)
        rate = 0.1;
    if(2850<salary&&salary<=5850)
        rate = 0.15;
    if(salary>5850)
        rate = 0.2;
    tax = rate * (salary-850);
    printf("tax=%.2lf",tax);
    return 0;
}

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值