#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#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,1e10,0.45 } };
int main()
{
int income; //收入
int tax = 0; //纳税
int i; //控制循环和结构体
printf("输入输入income:");
scanf("%d", &income);
income -= TAXBASE;
for (i = 0; income >= TaxTable[i].end; i++)
{
tax += (TaxTable[i].end - TaxTable[i].start) * TaxTable[i].taxrate;
income -= TaxTable[i].end;
}
if(income > 3500)
tax += (income - TaxTable[i].start) * TaxTable[i].taxrate;
printf("应缴纳%d元\n", tax);
return 0;
}
![](https://img2023.cnblogs.com/blog/3168003/202304/3168003-20230425121333271-1755530045.png)