問題描述:
企業發放的獎金根據利潤提成。
利潤低於或等於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,求應發獎金總數。
代碼實現:
#include <stdio.h>
int main(int argc, char *argv[]) {
int a,t;
scanf("%d",&a);
switch(a/100000){
case 0:
t=a*0.1;
break;
case 1:
t=100000*0.1+(a-100000)*0.075;
break;
case 2:
case 3:
t=100000*0.1+100000*0.075+(a-200000)*0.05;
break;
case 4:
case 5:
t=100000*0.1+100000*0.075+200000*0.05+(a-400000)*0.03;
break;
case 6:
case 7:
case 8:
case 9:
t=100000*0.1+100000*0.075+200000*0.05+200000*0.03+(a-600000*0.015);
break;
default:
t=100000*0.1+100000*0.075+200000*0.05+200000*0.03+400000*0.015+(a-1000000)*0.01;
}
printf("%d",t);
return 0;
}
