#include<stdio.h> int main(void) { float n,m; printf("Input n:"); scanf("%f",&n); if(n<2000) { m=500; printf("%f",m); } else if(n>=2000&&n<5000) { m=500+(n-2000)*0.08; printf("%f",m); } else if(n>=5000&&n<10000) { m=500+3000*0.08+(n-5000)*0.1; printf("%f",m); } else { m=500+3000*0.08+500+(n-10000)*0.12; printf("%f",m); } return 0; }#include<stdio.h> int main() { int a,i; printf("Enter a:"); scanf("%d", &a); i = a / 1000; switch (i) { case 1: a = 500; printf("%d", a); break; case 2: a = a + (a - 2000) * 0.8; printf("%d", a); break; case 3: case 4: case 5: a = a + 240 + (a - 5000) * 0.1; printf("%d", a); break; case 6: case 7: case 8: case 9: case 10:a = a + 240 + 500 + (a - 10000) * 0.12; printf("%d", a); break; default: a = a + 240 + 500 + (a - 10000) * 0.12; printf("%d", a); } return 0; }
计算工资。已知某公司员工的工资底薪为500元,员工销售的软件金额与提成方式如下:
销售额<2000 没有提成
2000<=销售额<5000 提成8%