|
发表于 2017-8-11 18:08:56
|
显示全部楼层
#include<stdio.h>
int main()
{
double bonuslist[] = {10000,17500,27500,33500,39500};
double profits = 150000.0;
double bonus = 0.0;
printf("Enter profits:");
scanf("%lf",&profits);
if(profits >0.0)
{
if(profits <= 100000)bonus = profits * 0.1;
else if(profits > 100000 && profits <=200000)
bonus = bonuslist[0] + (profits - 100000) * 0.075;
else if(profits > 200000 && profits <=400000)
bonus = bonuslist[1] + (profits - 200000) * 0.05;
else if(profits > 400000 && profits <=600000)
bonus = bonuslist[2] + (profits - 400000) * 0.03;
else if(profits > 600000 && profits <=1000000)
bonus = bonuslist[3] + (profits - 600000) * 0.015;
else if(profits >= 1000000)
bonus = bonuslist[4] + (profits - 1000000) * 0.01;
printf("%f\n",bonus);
}
else
printf("0");
return 0;
} |
|