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