该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
#include
#define TAXBASE 3500 //起征点
typedef struct{ //征税区间与征税率
long start;
long end;
double taxrate;
} TAXTABLE;
TAXTABLE TaxTable[]={{0,1500,0.03},{1500,4500,0.10},{4500,9000,0.20},
{9000,35000,0.25},{35000,55000,0.30},{55000,80000,0.35},{80000,1e9,0.45}};
double CaculateTax(long profit)
{
int i;
double tax = 0.0;
profit -= TAXBASE;
for(i=0;iTaxTable[i].start)
{
if(profit>TaxTable[i].end)
{
tax += (TaxTable[i].end-TaxTable[i].start)*TaxTable[i].taxrate;
} else{
tax += (profit-TaxTable[i].start)*TaxTable[i].taxrate;
printf("征税范围:%6ld~%6ld 该范围内缴税金额%6.2f\n",TaxTable[i].start,TaxTable[i].end,tax);
return tax;
}
printf("征税范围:%6ld~%6ld 该范围内缴税金额:%6.2f\n",TaxTable[i].start,TaxTable[i].end,tax);
}
}
return tax;
}
void main()
{
long profit;
double tax;
printf("请输入个人收入金额:");
scanf("%ld",&profit);
tax = CaculateTax(profit);
printf("您的个人所得税为:%f\n",tax);
}