C-study/03-1/2/2.c

25 lines
558 B
C
Raw Permalink Normal View History

2021-10-29 16:05:32 +00:00
#include<stdio.h>
int main()
{
int deduction;
float salary,tax,rate;
scanf("%f",&salary);
if(salary<=3500){rate=0;deduction=0;}
else if(salary<=5000){rate=0.03;deduction=0;}
else if(salary<=8000){rate=0.1;deduction=105;}
else if(salary<=12500){rate=0.2;deduction=555;}
else if(salary<=38500){rate=0.25;deduction=1005;}
else if(salary<=58500){rate=0.3;deduction=2755;}
else if(salary<=83500){rate=0.35;deduction=5505;}
else {rate=0.45;deduction=13505;}
tax = rate * salary - rate * 3500 - deduction;
printf("%.2f",tax);
return 0;
}