C刷题记录-1010

题目描述

企业发放的奖金根据利润提成。利润低于或等于100000元的,奖金可提10%;
利润高于100000元,低于200000元(100000<I≤200000)时,低于100000元的部分按10%提成,高于100000元的部分,可提成 7.5%;
200000<I≤400000时,低于200000元部分仍按上述办法提成,(下同),高于200000元的部分按5%提成;
400000<I≤600000元时,高于400000元的部分按3%提成;

600000<I≤1000000时,高于600000元的部分按1.5%提成;
I>1000000时,超过1000000元的部分按1%提成。从键盘输入当月利润I,求应发奖金总数。

输入

一个整数,当月利润。

输出

一个整数,奖金。

样例输入

900

样例输出

90

 1 #include <stdio.h>
 2 
 3 int main(){
 4   unsigned int profit,bonus;
 5   scanf("%d",&profit);
 6   switch(profit/100000)
 7   {
 8     case 0: bonus = (int)(profit * 0.1);break;
 9     case 1:
10     case 2:
11         bonus = (int)((profit-100000)*0.075) +10000;break;
12     case 3:
13     case 4:
14         bonus = (int)((profit-200000)*0.05) +17500;break;
15     case 5:
16     case 6:
17         bonus = (int)((profit-400000)*0.03) +27500;break;
18     case 7:
19     case 8:
20     case 9:
21     case 10:
22         bonus = (int)((profit-600000)*0.015) +33500;break;
23     default:
24         bonus = (int)((profit-1000000)*0.001) +39500;break;
25   }
26   printf("%d",bonus);
27 
28   return 0;
29 }
原文地址:https://www.cnblogs.com/xiangxyq/p/7798845.html