点击(此处)折叠或打开
- #include <stdio.h>
-
- int main(){
- float f_profit, f_bonus;
-
- while (scanf_s("%f", &f_profit) != EOF){
- if (f_profit <= 10)
- f_bonus = f_profit * 0.1;
- if (f_profit > 10 && f_profit <= 20)
- f_bonus = (f_profit - 10) * 0.075 + 1;
- if (f_profit > 20 && f_profit <= 40)
- f_bonus = (f_profit - 20) * 0.05 + 1 + 0.75;
- if (f_profit > 40 && f_profit <= 60)
- f_bonus = (f_profit - 40) * 0.03 + 1 + 0.75 + (0.5 * 2);
- if (f_profit > 60 && f_profit <= 100)
- f_bonus = (f_profit - 60) * 0.015 + 1 + 0.75 + (0.5 * 2) + (0.3 * 2);
- if (f_profit > 100)
- f_bonus = (f_profit - 100) * 0.01 + 1 + 0.75 + (0.5 * 2) + (0.3 * 2) + (0.15 * 4);
-
- printf("the bonus is %.2f!\n", f_bonus);
- }
- return 0;
- }
相关热门文章
给主人留下些什么吧!~~
评论热议