学习笔记3
#include <stdio.h>#define fanqie 3.7
#define jielan 7
#define xiqing 1.3
#define kongxincai 8
#define yangchong 2.4
#define youcai 9
#define huanggua 6.3
#define bailuobo 0.5
int main()
{
float price;
price=(2*fanqie+kongxincai+youcai)*0.5;//一斤等于0.5千克
printf("小明需要给%.2f元\n",price);
price=(3*xiqing+0.5*yangchong+5*huanggua)*0.5;
printf("小红需要给%.2f元\n",price);
price=(10*huanggua+20*bailuobo)*0.5;
printf("小甲鱼需要给%.2f元\n",price);
return 0;
}
页:
[1]