代码改变世界

税收工资分级

2021-07-28 14:51  huqi001  阅读(66)  评论(0编辑  收藏  举报

#include <stdio.h>
#include <windows.h>
#define single 1
#define host 2
#define married 3
#define divorce 4
int main(void)
{
int a=0,b=0;
printf("请输入类别(single=1,host=2,married=3,divorce=4)type=%d\n",a);
printf("请输入money=%d\n",b);

while (scanf_s("%d%d", &a, &b) == 2)
{
if ((a == single) && (b<= 17850))
printf("Tax is %lf", b*0.15);
else if ((a == single) && (b > 17850))
printf("Tax is %lf",17850*0.15+(b-17850)*0.28);
else if ((a == host) && (b<=23900))
printf("Tax is %lf", b*0.15);
else if ((a == host) && (b > 23900))
printf("Tax is %lf", 23900 * 0.15 + (b - 23900)*0.28);
else if ((a == married) && (b <= 29750))
printf("Tax is %lf", b*0.15);
else if ((a == married) && (b > 29750))
printf("Tax is %lf", 29750 * 0.15 + (b - 29750)*0.28);
else if ((a == divorce) && (b <= 14875))
printf("Tax is %lf", b*0.15);
else if ((a == divorce) && (b > 14875))
printf("Tax is %lf", 14875 * 0.15 + (b - 14875)*0.28);
else
continue;

}
system("pause");
return 0;
}