输入月薪salary,输出应交的个人所得税tax.公式tax=rate*(salary-3500)-deduction.我的程序是:#include<stdio.h>int main(void){ int salary,deduction; double rate,tax; printf("Enter salary(salary>0):\n"); scanf("
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 05:58:00
输入月薪salary,输出应交的个人所得税tax.公式tax=rate*(salary-3500)-deduction.我的程序是:#include<stdio.h>int main(void){ int salary,deduction; double rate,tax; printf("Enter salary(salary>0):\n"); scanf("
输入月薪salary,输出应交的个人所得税tax.公式tax=rate*(salary-3500)-deduction.
我的程序是:
#include<stdio.h>
int main(void)
{
int salary,deduction;
double rate,tax;
printf("Enter salary(salary>0):\n");
scanf("%d",&salary);
if(salary<=3500)
printf("tax=0");
else if(salary<=5000)
rate=0.03;
deduction=0;
tax=rate*(salary-3500)-deduction;
printf("tax=%.2f\n",tax);
else if(salary<=8000)
rate=0.1;
deduction=105;
tax=rate*(salary-3500)-deduction;
printf("tax=%.2f\n",tax);
else if(salary<=12500)
rate=0.2;
deduction=555;
tax=rate*(salary-3500)-deduction;
printf("tax=%.2f\n",tax);
else if(salary<=38500)
rate=0.25;
deduction=1005;
tax=rate*(salary-3500)-deduction;
printf("tax=%.2f\n",tax);
else if(salary<=58500)
rate=0.3;
deduction=2755;
tax=rate*(salary-3500)-deduction;
printf("tax=%.2f\n",tax);
else if(salary<=83500)
rate=0.35;
deduction=5505;
tax=rate*(salary-3500)-deduction;
printf("tax=%.2f\n",tax);
else if(salary>83500)
rate=0.45;
deduction=13505;
tax=rate*(salary-3500)-deduction;
printf("tax=%.2f\n",tax);
else
printf("Type the right salary please");
return 0;
}
提示出错在第20行,也就是第二个else if 那里.求教,怎么改?
输入月薪salary,输出应交的个人所得税tax.公式tax=rate*(salary-3500)-deduction.我的程序是:#include<stdio.h>int main(void){ int salary,deduction; double rate,tax; printf("Enter salary(salary>0):\n"); scanf("
大哥首先你if,else if里面的语句块能用{}括起来吗,你这么些事闹哪样啊,还有你写代码,就这格式,看着不觉得费劲啊,哎,算了,你把括号括起来之后再看又没错吧,看着蛋疼