1011: 计算个人所得税
假设个人所得税为:税率×(工资-1600),其中税率定义为: (1)当工资不超过1600时,税率为0; (2)当工资在区间(1600, 2500]时,税率为5%; (3)当工资在区间(2500, 3500]时,税率为10%; (4)当工资在区间(3500, 4500]时,税率为15%; (5)当工资超过4500时,税率为20%。
请编写程序计算应缴的所得税。 Input 多组测试数据,每组测试数据在一行中给出非负整数(表示工资)。 Output 每组测试数据在一行输出个人所得税,精确到小数点后2位。 Sample Input 1600 1601 3000 4000 5000
Sample Output 0.00 0.05 140.00 360.00 680.00
#include<stdio.h> int main() { int a; float s,w; while(scanf("%d",&a)!=EOF) { if(a<=1600) w=0; else if(a>1600&&a<=2500) w=0.05; else if(a>2500&&a<=3500) w=0.10; else if(a>3500&&a<=4500) w=0.15; else w=0.20; s=fabs(w*(a-1600)); printf("%.2f\n",s); } return 0; }