#include<stdio.h>
#include<stdlib.h>
#define tax1 0.15
#define tax2 0.20
#define tax3 0.25
int main(void)
{
int hour,salary;
float tax,net_income;
printf("请输入一周工作的小时数:");
while(scanf("%d",&hour)==1&&hour>0)
{
if(hour<=40)salary=hour*10;
else salary=10*(40+1.5*(hour-40));
}
if(salary<=300)net_income=(float)salary*(1-tax1);
else if(salary>300&&salary<=450)net_income=(float)300*(1-tax1)+(salary-300)*(1-tax2);
else net_income=(float)300*(1-tax1)+150*(1-tax2)+(salary-450)*(1-tax3);
tax=(float)salary-net_income;
printf("工资总额:%d 税金:%f 净收入:%f",salary,tax,net_income);
return 0;
}
《C Primer Plus》中文第六版 编程练习答案 第七章 第七题
于 2024-01-14 11:20:15 首次发布