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

C语言代码

#include <stdio.h>

int main(int argc, const char *argv[])
{
    //定义一个无符号整型变量并初始化为0
    unsigned int Profit = 0;

    //输入数据
    scanf("%u",&Profit);

    //如果输入的数据不符合条件,则直接退出程序
    if(0 > Profit){
        return 0;
    }

    //采用if……else语句判断
    unsigned int Bonus = 0;

    if(Profit <= 100000){
        Bonus += Profit * 0.1;
        printf("%d\n", Bonus);
    }else if(Profit <= 200000){
        Bonus += 100000 * 0.1;
        Bonus += (Profit - 100000) * 0.075;
        printf("%d\n", Bonus);
    }else if(Profit <= 400000){
        Bonus += 100000 * 0.1;
        Bonus += 100000 * 0.075;
        Bonus += (Profit - 200000) * 0.05;
        printf("%d\n", Bonus);
    }else if(Profit <= 600000){
        Bonus += 100000 * 0.1;
        Bonus += 100000 * 0.075;
        Bonus += 200000 * 0.05;
        Bonus += (Profit - 400000) * 0.03;
        printf("%d\n", Bonus);
    }else if(Profit <= 1000000){
        Bonus += 100000 * 0.1;
        Bonus += 100000 * 0.075;
        Bonus += 200000 * 0.05;
        Bonus += 200000 * 0.03;
        Bonus += (Profit - 600000) * 0.015;
        printf("%d\n", Bonus);
    }else{
        Bonus += 100000 * 0.1;
        Bonus += 100000 * 0.075;
        Bonus += 200000 * 0.05;
        Bonus += 200000 * 0.03;
        Bonus += 400000 * 0.015;
        Bonus += (Profit - 1000000) * 0.01;
        printf("%d\n", Bonus);
    }

    return 0;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值