代码文本:
#include "stdio.h"
int main(int argc,char *argv[]){
double x,tax;
printf("Please enter the number salary, negative end...\n");
while(scanf("%lf",&x),x>=0){
if(x>=5000)
tax=(x-5000)*0.2+4200*.03;
else if(x>=800 && x<5000)
tax=(x-800)*.03;
else
tax=0;
printf("You should pay %.2f yuan.\n",tax);
}
return 0;
}
#include <stdio.h>
#include <stdlib.h>
int jishu(double x)
{
if(0<x&&x<=500)
return 1;
else if(500<x&&x<=2000)
return 2;
else if(2000<x&&x<=5000)
return 3;
else if(5000<x&&x<=20000)
return 4;
else if(20000<x&&x<=40000)
return 5;
else if(40000<x&&x<=60000)
return 6;
else if(60000<x&&x<=80000)
return 7;
else if(80000<x&&x<=100000)
return 8;
else
return 9;
}
main()
{
double rate[10]={0.0,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45};
int a[10]={0,0,25,125,375,1375,3375,6375,10375,15375};
double n,m,l;
int i;
printf("请输入工资:");
scanf("%lf",&l);
if(l<=3500)
printf("您不用交税\n");
else
{
n=l-3500.0;
i=jishu(n);
m=n*rate[i]-a[i];
printf("应缴个人所得税:%.2lf\n实发工资额:%.2lf\n",m,l-m);
}
}
这是按你说的计算方法