题解 | #计算商品打折结算金额#
计算商品打折结算金额
http://www.nowcoder.com/practice/055a92b5c93f497291a58c232f59fae9
int main()
{
int a;
double b = 0;
scanf("%d", &a);
if (a < 100)
{
b = a;
printf("%.1f\n", b);
}
else if (a >= 100 && a < 500)
{
b = a*0.9;
printf("%.1f\n", b);
}
else if (a >= 500 && a < 2000)
{
b = a * 0.8;
printf("%.1f\n", b);
}
else if (a >= 2000 && a < 5000)
{
b = a * 0.7;
printf("%.1f\n", b);
}
else if (a >= 5000)
{
b = a * 0.6;
printf("%.1f\n", b);
}
return 0;
}