求大神指教~!好人吃方便面两包调料
c语言吧
全部回复
仅看楼主
level 1
w8231685 楼主
#include<stdio.h>
int main(void)
{
int salary,deduction;
double tax,rate;
scanf("%d",&salary);
if(salary<=3500)
{
rate=0;
deduction=0;
}
else if(salary<=5000)
{
rate=3%;
deduction=0;
}
else if(salary<=8000)
{
rate=10%;
deduction=105;
}
else if(salary<=12500)
{
rate=20%;
deduction=555;
}
else if(salary<=38500)
{
rate=25%;
deduction=1005;
}
else if(salary<=58500)
{
rate=30%;
deduction=2755;
}
else if(salary<=83500)
{
rate=35%;
deduction=5505;
}
else if(salary>83500)
{
rate=45%;
deduction=13505;
}
tax=rate*(salary-3500)-deduction;
printf("salary=%d,tax=%.2f\n",salary,tax);
return 0;
}
2014年03月17日 09点03分 1
level 9
rate=3%; 改为rate = 0.03; 下面的也都改掉试试
2014年03月17日 09点03分 2
谢谢了[花心]
2014年03月17日 10点03分
level 13
rate=3%;//%这个是双目运算符,是取余运算,;前没有除数,这个不是百分号……
2014年03月17日 10点03分 3
谢谢了[花心]
2014年03月17日 10点03分
1