0:
#include <stdio.h>
#define NL '\n'
int main()
{
printf("Line1%c", NL);
printf("Line2%c", NL);
return 0;
}
1:
#include <stdio.h>
#define PI 3.14159
#define S(r) PI * r * r
#define C(R) 2 * PI * r
int main()
{
int r = 5;
printf("半径为%d的圆,面积是:%.2f,周长是:%.2f\n", r, S(r), C(r));
return 0;
}
2:
#include <stdio.h>
#define Tomato 3.7
#define JieLan 7
#define XiQin 1.3
#define KongXin 8
#define Yangcong 2.4
#define Youcai 9
#define HuangGua 6.3
#define BaiLuoBu 0.5
int main()
{
float price = Tomato + (KongXin * 0.5) + (Youcai * 0.5); // 建议使用乘以而不是除以,除会导致结果误差大
float price1 = (XiQin * 1.5) + (Yangcong * 0.25) + (HuangGua * 2.5);
float price2 = (HuangGua * 5) + (BaiLuoBu * 10);
printf("小明需要支付%.2f",price);
printf("小红需要支付%.2f",price1);
printf("小甲需要支付%.2f",price2);
return 0;
}