解题思路:
       分段判断
注意事项:
       计算时不用百分数表述;
参考代码:

#include<stdio.h>

int main()

{

    int profit;  //利润

    double bonus;//奖金

    scanf("%d",&profit);

    if(profit<=100000) bonus=profit*0.1;

    else if(profit<=200000) 

        bonus=100000*0.1+(profit-100000)*0.075;

    else if(profit<=400000) 

        bonus=100000*0.1+100000*0.075+(profit-200000)*0.05;

    else if(profit<=600000) 

        bonus=100000*0.1+100000*0.075+200000*0.05+(profit-400000)*0.03;

    else if(profit<=1000000) 

        bonus=100000*0.1+100000*0.075+200000*0.05+200000*0.03+(profit-600000)*0.015;

    else 

        bonus=100000*0.1+100000*0.075+200000*0.05+200000*0.03+400000*0.015+(profit-1000000)*0.01;


printf("%d\n",(int)bonus);

return 0;

}



 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区