2017年10月8日 星期日

[C] 綜合所得稅試算

/*
 
說明
 
請根據綜合所得稅速算公試表,求出使用者輸入綜合所得淨額後,印出稅率、稅金、累進差額還有今年應納稅額。
 
Input Format
 
今年所得
 
Output Format
 
所得淨額:
稅額:
稅金:
累進差額:
今年應繳:
 
Sample Input
 
1230000
 
Sample Output
 
income 1230000
tax rate 21%
tax 258300
discount 105100
taxpay 153200
 
*/
 
#include <stdio.h>
 
int main()
{
    int income, discount;
    double taxrate;
 
    scanf("%d", &income);
 
    if(income>=0 && income<=370000){
        taxrate = 0.06;
        discount = 0;
    }
 
    else if(income>370000 && income<=990000){
        taxrate = 0.13;
        discount = 25900;
    }
 
    else if(income>990000 && income<=1980000){
        taxrate = 0.21;
        discount = 105100;
    }
 
    else if(income>1980000 && income<=3720000){
        taxrate = 0.3;
        discount = 283300;
    }
 
    else if(income>3720000){
        taxrate = 0.4;
        discount = 655300;
    }
 
    else{
        printf("input error\n");
    }
 
    printf("income %d\n", income);
    printf("tax rate %.0f%%\n", taxrate*100);
    printf("tax %.0f\n", income*taxrate);
    printf("discount %d\n", discount);
    printf("taxpay %.0f\n", income*taxrate-discount);
 
    return 0;
}

沒有留言:

張貼留言