解题思路:
注意事项:
参考代码:
#include<stdio.h> #define NUM 100000 int main() { int i; double money; scanf("%d",&i); if(i<=NUM){ money = i*0.1; printf("%.0f\n",money); } else if(i>NUM && i<=2*NUM){ money = NUM*0.1+(i-NUM)*0.075; printf("%.0f\n",money); } else if(2*NUM<i && i<=4*NUM){ money = NUM*(0.1+0.75)+(i-2*NUM)*0.05; printf("%.0f\n",money); } else if(4*NUM<i && i<=6*NUM){ money = NUM*(0.1+0.075+0.05)+(i-4*NUM)*0.03; printf("%.0f\n",money); } else if(6*NUM<i && i<=10*NUM){ money = NUM*(0.1+0.075+0.05+0.03)+(i-6*NUM)*0.015; printf("%.0f\n",money); } else if(10*NUM<i){ money = NUM*(0.1+0.075+0.05+0.03+0.015)+(i-10*NUM)*0.001; printf("%.0f\n",money); } return 0; }
0.0分
0 人评分
数字整除 (C语言代码)浏览:847 |
C语言程序设计教程(第三版)课后习题9.8 (C语言代码)浏览:1238 |
C语言程序设计教程(第三版)课后习题6.11 (C语言代码)for循环浏览:1178 |
C语言训练-角谷猜想 (C语言代码)浏览:1767 |
简单的a+b (C++语言代码)浏览:895 |
完数 (C语言代码)浏览:757 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:350 |
C语言程序设计教程(第三版)课后习题9.3 (C语言代码)浏览:650 |
矩阵转置 (C语言代码)浏览:855 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:593 |