// 请编程，根据个人收入计算个人所得税，免税额为3500

//     > 7级超额累进税率： >> 全月应纳税所得额 税率 速算扣除数(元) >> 全月应纳税额不超过1500元 3 % 0 >> 全月应纳税额超过1500元至4500元 10 % 105 >> 全月应纳税额超过4500元至9000元 20 % 555 >> 全月应纳税额超过9000元至35000元 25 % 1005 >> 全月应纳税额超过35000元至55000元 30 % 2755 >> 全月应纳税额超过55000元至80000元 35 % 5505 >> 全月应纳税额超过80000元 45 % 13505 >> 例如：你月收入 : 3000,
//     低于免税额3500，不必缴税；
//         >> 月收入 : 4000,
//     4000 - 3500 = 500 < 1500, 属于第一档，缴税 = (4000 - 3500) * 0.03 - 0 == 15 月收入 : 15000, 15000 - 3500 = 11500, 属于第四档, 缴税 = (15000 - 3500) * 0.25 - 1005 == 1870 >> 要求：输入你的税前收入，输出：你最后的所得以及缴纳的税额
#include <stdio.h>

int main()
{
    int pretexIncome;   // 税前收入
    double rate;        // 税率
    int deduct;         // 速算扣除数
    int tex;            // 缴纳税额
    int aftertexIncome; // 税后收入
    printf("请输入你的税前收入: ");
    scanf("%d", &pretexIncome);

    int diff = pretexIncome - 3500; // 征税差值
    if (diff <= 0)
    {
        rate = 0;
        deduct = 0;
    }
    else if (diff > 0 && diff <= 1500)
    {
        rate = 0.03;
        deduct = 0;
    }
    else if (diff > 1500 && diff <= 4500)
    {
        rate = 0.1;
        deduct = 105;
    }
    else if (diff > 4500 && diff <= 9000)
    {
        rate = 0.2;
        deduct = 555;
    }
    else if (diff > 9000 && diff <= 35000)
    {
        rate = 0.25;
        deduct = 1005;
    }
    else if (diff > 35000 && diff <= 55000)
    {
        rate = 0.3;
        deduct = 2755;
    }
    else if (diff > 55000 && diff <= 80000)
    {
        rate = 0.35;
        deduct = 5505;
    }
    else if (diff > 80000)
    {
        rate = 0.45;
        deduct = 13505;
    }

    tex = diff * rate - deduct;
    aftertexIncome = pretexIncome - tex;
    printf("你最后的所得为 %d ，你所缴纳的税额为 %d\n", aftertexIncome, tex);

    return 0;
}