void main()
{
double a, rate
int c,tax,profit
printf("输入奖金数:")
scanf("%lf",&a)
if(a>=5000)c=10
else c=a/500
switch(c) {
case 0: rate=0break
case 1: rate=0.05break
case 2:
case 3:
case 4: rate=0.08break
case 5:
case 6:
case 7:
case 8:
case 9: rate=0.10break
case 10: rate=0.15break
}
printf("%d",c)
tax=(a*rate)
profit=(int)(a-tax)
printf("税率为%lf,应缴税款为%d,实得奖金数为%d\n",rate,tax,profit)
}
#include<stdio.h>int main()
{
int I
double S=0 //定义成double才能看到小数部分,不然会出现数据丢失
printf("Please input the Profit:")
scanf("%d",&I)
if(I<=100000)
S=I*0.1
else if(I>100000&&I<=200000)
S=100000*0.1+(I-100000)*0.075
else if(I>200000&&I<=400000)
S=100000*0.1+100000*0.075+(I-200000)*0.05
else if(I>400000&&I<=600000)
S=100000*0.1+100000*0.075+200000*0.05+(I-400000)*0.03
else if(I>600000&&I<=1000000)
S=100000*0.1+100000*0.075+200000*0.05+200000*0.03+(I-600000)*0.015
else //这里不要有判断了
S=100000*0.1+100000*0.075+200000*0.05+200000*0.03+400000*0.015+(I-1000000)*0.001
printf("S=%lf\n", S )
return 0
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)