Description
新年到了,商场狂打折。一件衣服x元,消费满y元,可打八五折。输入购买衣服的件数n,输出需要支付的金额(元),保留两位小数。
Input
衣服单价x(元),打折的最低消费y(元),购买衣服的件数n
Output
输出需要支付的金额(元),保留两位小数。
Sample Input
95.5 300 5
Sample Output
405.88
- #include <stdio.h>
int
main()
- {
float
x,y,n,s;
scanf
(
"%f%f%f"
,&x,&y,&n);
if
(x*n>y) s=0.85*x*n;
//判断若消费满y元 则打八五折 else
s=x*n;
printf
(
"%.2f"
,s);
return
0;
- }