/*
企业发放的奖金利润提成:
利润(I)低于或等于10万元时,奖金可提10%;
利润高于10万元,低于20万元时,低于10万元的部分按10%提成,高于10万元的按7.5%提成;
20万元到40万元之间时,高于20万元的部分,可提成5%;
40万元到60万元之间时,高于40万元的部分,可提成3%;
60万元到100万元之间时,高于60万元的部分,可提成1.5%;
高于100万元时,超过100万元的部分按1%提成
从键盘输入当月的利润I,求应发放的奖金总数
*/
#include<stdio.h>
int main()
{
int profit = 0;
int bouns = 0;
int bouns1 = 100000 * 0.1;
int bouns2 = bouns1 + 100000 * 0.075;
int bouns3 = bouns2 + 200000 * 0.05;
int bouns4 = bouns3 + 400000 * 0.03;
int bouns5 = bouns4 + 600000 * 0.015;
printf("请输入当月利润:");
scanf_s("%d", &profit);
if (profit <= 100000) {
bouns = profit * 0.1;
}
else if (profit <= 200000) {
bouns = bouns1 + (profit - 100000) * 0.075;
}
else if (profit <= 400000) {
bouns = bouns2 + (profit - 200000) * 0.05;
}
else if (profit <= 600000) {
bouns = bouns3 + (profit - 400000) * 0.03;
}
else if (profit <= 10000000) {
bouns = bouns4 + (profit - 600000) * 0.015;
}
else {
bouns = bouns5 + (profit - 1000000) * 0.01;
}
printf("bouns=%d\n", bouns);
return 0;
}
C语言——求利润
最新推荐文章于 2024-07-17 17:57:05 发布