2.超市促销,进行购物打折活动,如顾客一次性购物款为b,当100≤b<200时,95折优惠;当200 ≤b<300时,9折优惠;当300≤b<500时,8.5折优惠;当b≥500元时,8折优惠。编写程序,输入购物款,输出顾客应付款(低于100元无优惠)
时间: 2023-03-24 22:02:51 浏览: 97
您好,根据您提供的信息,我可以编写一个简单的程序来计算顾客的应付款。请看以下代码:
```
#include <stdio.h>
int main() {
float b, price;
printf("请输入购物款:");
scanf("%f", &b);
if (b < 100) {
price = b;
} else if (b < 200) {
price = b * .95;
} else if (b < 300) {
price = b * .9;
} else if (b < 500) {
price = b * .85;
} else {
price = b * .8;
}
printf("顾客应付款为:%.2f元\n", price);
return ;
}
```
这个程序会要求用户输入购物款,然后根据购物款的大小计算出顾客的应付款,并输出结果。如果购物款低于100元,则不打折。如果购物款在不同的范围内,则享受不同的折扣。
相关问题
用c写某购物中心根据顾客购买商品的总金额进行打折促销,输入顾客购买商品的总金额x(设x是大于0的整数),计算并输出顾客应付总金额y(要求使用选择结构实现)。y=x,x<100,y=0.95x,100≤x<200,y=0.9x,200≤x<400,y=0.85x,x≥400>
根据您的要求,我可以回答这个问题。以下是用 C 语言实现的代码:
#include <stdio.h>
int main() {
int x, y;
printf("请输入顾客购买商品的总金额:");
scanf("%d", &x);
if (x < 100) {
y = x;
} else if (x < 200) {
y = 0.95 * x;
} else if (x < 400) {
y = 0.9 * x;
} else {
y = 0.85 * x;
}
printf("顾客应付总金额为:%d\n", y);
return 0;
}
某商场推出打折促销活动:若顾客购物额不满 100 元则不优惠;达到或超过 100 元则九五折优惠;达到或超过 200 元则九折优惠;达到或超过 500 元则八五折优惠;达到或超过 1000 元则八折优
这个商场推出了一项打折促销活动,根据顾客购物的金额不同,享受不同的优惠力度。如果顾客的购物金额不到100元,则不享受任何优惠;如果购物金额达到或超过100元,则可以享受95折的优惠;如果购物金额达到或超过200元,则可以享受9折的优惠;如果购物金额达到或超过500元,则可以享受85折的优惠;如果购物金额达到或超过1000元,则可以享受8折的优惠。是的,您的理解是正确的。商场推出了一项打折促销活动,根据顾客的购物金额不同,享受不同的优惠力度。如果顾客的购物金额不到100元,则不享受任何优惠;如果购物金额达到或超过100元,则可以享受95折的优惠;如果购物金额达到或超过200元,则可以享受9折的优惠;如果购物金额达到或超过500元,则可以享受85折的优惠;如果购物金额达到或超过1000元,则可以享受8折的优惠。该商场推出的打折促销活动规则是:如果顾客购买物品的金额不足100元,则没有优惠;如果顾客购买物品的金额达到或超过100元,则享受95折优惠;如果顾客购买物品的金额达到或超过200元,则享受9折优惠;如果顾客购买物品的金额达到或超过500元,则享受8.5折优惠;如果顾客购买物品的金额达到或超过1000元,则享受8折优惠。
请问,如果一个顾客购买了价值850元的商品,那么他可以享受多少折的优惠?折后价格是多少?
请用中文回答。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)