解题思路:
利用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 人评分
2005年春浙江省计算机等级考试二级C 编程题(3) (C语言代码)浏览:388 |
弟弟的作业 (C++代码)浏览:1295 |
C二级辅导-进制转换 (C语言代码)浏览:615 |
C语言程序设计教程(第三版)课后习题7.5 (C语言代码)浏览:519 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:594 |
用筛法求之N内的素数。 (C语言代码)浏览:646 |
C语言程序设计教程(第三版)课后习题9.10 (C语言代码)浏览:548 |
用筛法求之N内的素数。 (C++代码)浏览:692 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:326 |
演讲大赛评分 (C语言代码)浏览:1629 |