C语言代码:计算员工当月薪水(含利润提成)
#include <stdio.h>
int main() { int profit; // 工程利润 float bonus; // 提成比率 float salary = 500; // 员工保底薪水
printf('请输入本月工程利润:');
scanf('%d', &profit);
if (profit <= 1000) {
bonus = 0;
} else if (profit <= 2000) {
bonus = 0.1;
} else if (profit <= 5000) {
bonus = 0.15;
} else if (profit <= 10000) {
bonus = 0.2;
} else {
bonus = 0.25;
}
salary += profit * bonus; // 计算当月薪水
printf('当月薪水为:%.2f元\n', salary);
return 0;
}
原文地址: https://www.cveoy.top/t/topic/kgCm 著作权归作者所有。请勿转载和采集!