解题思路:
利用if else if语句,不知道为什么在网站上总是报错,有大神可以帮忙看下吗?感谢
注意事项:
参考代码:
#include <stdio.h>
int main()
{
int l,t;
printf("请输入这个月的利润:");
scanf("%d",&l);
if(l<=10000)
{ t=(int)(l*0.1);
printf("%d\n",t);
}
else if(l>10000&&l<=20000)
{ t=(int)((l-10000)*0.075+10000*0.1);
printf("%d\n",t);
}
else if(l>20000&&l<=40000)
{
t=(int)(10000*0.075+10000*0.1+(l-20000)*0.05);
t=
printf("%d\n",t);
}
else if(l>40000&&l<=60000)
{
t=(int)(10000*0.075+10000*0.1+20000*0.05+(l-40000)*0.03);
printf("%d\n",t);
}
else if(l>60000&&l<=100000)
{
t=(int)(10000*0.075+10000*0.1+20000*0.05+40000*0.03+(l-60000)*0.015);
printf("%d\n",t);
}
else
{ t=(int)(10000*0.075+10000*0.1+20000*0.05+40000*0.03+60000*0.015+(l-100000)*0.01);
printf("%d\n",t);
}
return 0;
}
0.0分
0 人评分
C二级辅导-分段函数 (C语言代码)浏览:564 |
2006年春浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:468 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:596 |
校门外的树 (C语言代码)浏览:961 |
完数 (C语言代码)浏览:693 |
1013题解浏览:560 |
妹子杀手的故事 (C语言代码)浏览:1054 |
勾股数 (C语言代码)浏览:799 |
数列问题 (C语言代码)浏览:1022 |
C语言程序设计教程(第三版)课后习题11.8 (C语言代码)浏览:1001 |