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