打酱油的


私信TA

用户名:1017563043

访问量:4786

签 名:

摸鱼使我快乐

等  级
排  名 935
经  验 3329
参赛次数 0
文章发表 73
年  龄 22
在职情况 学生
学  校 广州松田职业学院
专  业 计算机应用技术

  自我简介:

略略略略略略~~~~

解题思路:利用case进行累加

注意事项:每次累加后,利润profit更新为被减数

参考代码:

#include <stdio.h>

int main()

{

int profit; //当月利润

int bonus=0; //奖金

scanf("%d",&profit);

if(profit>=0)

switch(profit/100000)

{

default:bonus+=(profit-1000000)*0.01;profit=1000000;

case 9:

case 8:

case 7:

case 6:bonus+=(profit-600000)*0.015; profit=600000;

case 5:

case 4:bonus+=(profit-400000)*0.03;  profit=400000;

case 3:

case 2:bonus+=(profit-200000)*0.05;  profit=200000;

case 1:bonus+=(profit-100000)*0.075; profit=100000;

case 0:bonus+=profit*0.1;

}

printf("%d",bonus);

}















 

0.0分

0 人评分

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

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区