zoukankan      html  css  js  c++  java
  • 7.12.10 计算税金

    # 7.12.10
    #include <stdio.h>
    #define big_rate 0.28
    #define sml_rate 0.15
    #define single 17850
    #define god 23900
    #define mar_two 29750
    #define mar_one 14875
    int main(void)
    {
        float earnings, tax;
        int tax_sort, judge;
    
        printf("**********************************************************
    ");
        printf("1.单身
    ");
        printf("2.户主
    ");
        printf("3.已婚,共有
    ");
        printf("4.已婚,离异
    ");
        printf("**********************************************************
    ");
        printf("请选择缴纳税金种类: ");
        judge = scanf("%d", &tax_sort);
        printf("请输入应纳税收入:");
        scanf("%f", &earnings);
    
        while (judge)
        {
            switch(tax_sort)
            {
                case 1: 
                    if (earnings > single)
                        tax = sml_rate * single + big_rate * (earnings - single);
                    else
                        tax = sml_rate * earnings;
                    break;
                case 2: 
                    if (earnings > god)
                        tax = sml_rate * god + big_rate * (earnings - god);
                    else
                        tax = sml_rate * earnings;
                    break;
                case 3: 
                    if (earnings > mar_two)
                        tax = sml_rate * mar_two + big_rate * (earnings - mar_two);
                    else
                        tax = sml_rate * earnings;
                    break;
                case 4: 
                    if (earnings > mar_one)
                        tax = sml_rate * mar_one + big_rate * (earnings - mar_one);
                    else
                        tax = sml_rate * earnings;
                    break;
            }
            printf("应缴纳税金:%.2f
    ", tax);
    
            printf("**********************************************************
    ");
            printf("1.单身
    ");
            printf("2.户主
    ");
            printf("3.已婚,共有
    ");
            printf("4.已婚,离异
    ");
            printf("**********************************************************
    ");
            printf("请选择缴纳税金种类: ");
            judge = scanf("%d", &tax_sort);
            printf("请输入应纳税收入:");
            scanf("%f", &earnings);
        }
    
        return 0;
    }
    

  • 相关阅读:
    c语言寒假大作战02
    C语言寒假大作战01
    C语言I作业12
    C语言I博客作业11
    C语言I博客作业10
    C语言ll作业01
    C语言寒假大作战04
    C语言寒假大作战03
    C语言寒假大作战02
    C语言寒假大作战01
  • 原文地址:https://www.cnblogs.com/EisNULL/p/10819359.html
Copyright © 2011-2022 走看看