if语句的应用
程序员文章站
2022-06-21 18:53:23
...
#include <stdio.h>
#include <stdlib.h>
int main ()
{
double price1 = 262.7;
double price2 = 3215;
double price3 = 24836;
double total =price1 + price2 + price3;
double zhekou; //折扣
if(price1 > 1000 || price2 > 1000 || price3 > 1000 || total > 5000)
{
zhekou = 0.3;
}
else
{
zhekou = 0.9;
}
total = zhekou * total;
printf("败家娘们应支付的金额为:%.2f\n",total);
}