第1个回答 2010-11-23
void main()
{
begin:
int a,c;
float b,z=0;
printf("输入工资(元):");
scanf("%d",&a);
b=a-2000;
if(b<=500)
c=1;
else
if(b<=2000)
c=2;
else
if(b<=5000)
c=3;
else
if(b<=20000)
c=4;
else
if(b<=40000)
c=5;
else
if(b<=60000)
c=6;
else
if(b<=80000)
c=7;
else
if(b<=100000)
c=8;
else
if(b<=9998000)
c=9;
switch(c)
{
case 1:z=b*0.05;break;
case 2:z=b*0.10-25;break;
case 3:z=b*0.15-125;break;
case 4:z=b*0.20-375;break;
case 5:z=b*0.25-1375;break;
case 6:z=b*0.30-3375;break;
case 7:z=b*0.35-6375;break;
case 8:z=b*0.40-10375;break;
case 9:z=b*0.45-15375;break;
}
printf("应缴税为:%f\n",z);
printf("是否继续计算:");
char input = getchar();
if(input == 'y' || input == 'Y')
goto begin;
else if(input == 'n' || input == 'N')
;
else
;
}
第2个回答 2010-11-24
#include<stdio.h>
#include<string.h>
void main()
{
int a,c;
char d;
float b,z=0;
while(1)
{
printf("输入工资(元):");
scanf("%d",&a);fflush(stdin);
b=a-2000;
if(b<=500)
c=1;
else
if(b<=2000)
c=2;
else
if(b<=5000)
c=3;
else
if(b<=20000)
c=4;
else
if(b<=40000)
c=5;
else
if(b<=60000)
c=6;
else
if(b<=80000)
c=7;
else
if(b<=100000)
c=8;
else
if(b<=9998000)
c=9;
switch(c)
{
case 1:z=b*0.05;break;
case 2:z=b*0.10-25;break;
case 3:z=b*0.15-125;break;
case 4:z=b*0.20-375;break;
case 5:z=b*0.25-1375;break;
case 6:z=b*0.30-3375;break;
case 7:z=b*0.35-6375;break;
case 8:z=b*0.40-10375;break;
case 9:z=b*0.45-15375;break;
}
printf("应缴税为:%f\n",z);
printf("Y:继续;N结束\n");
scanf("%c",&d);
fflush(stdin);
if(d=='N'||d=='n')
break;
}
}