题解 | #计算商品打折结算金额#
计算商品打折结算金额
http://www.nowcoder.com/practice/055a92b5c93f497291a58c232f59fae9
#include<stdio.h> int main() { float money = 0; float final = 0; scanf("%f",&money); if(money>=0.0f && money<100.0f) final = money; else if(money>=100.0f && money<500.0f) final = 0.9f*money; else if(money>=500.0f && money<2000.0f) final = 0.8f*money; else if(money>=2000.0f && money<5000.0f) final = 0.7f*money; else if(money>=5000.0f) final = 0.6f*money; printf("%.1f\n",final); return 0; }