简单的判断
这个题目体面是很简单,但是逻辑还是要搞清楚才行
#include <cstdio>
int main()
{
double salary, tax = 0;
scanf("%lf", &salary);
if(salary<2000);//免税区间
else{
salary -= 2000;
if(salary < 1000)//3000以下
tax += salary * 0.08;
else{
tax += 80;
salary -= 1000;//超过3000部分
if(salary < 1500)//小于4500部分
tax += salary * 0.18;
else{
tax += 1500 * 0.18;
salary -= 1500;
tax += salary * 0.28;
}
}
}
if(tax == 0)
printf("Isento");
else printf("R$ %.2lf", tax);
return 0;
}