在C语言中,编写一个程序,要求:如果一个水分子的质量大约为3.0*10-23g,1夸脱水大约有950g。输入水的夸脱数,然后显示这么多水中包含多少个水分子。
#include <stdio.h>
#define water_num 3.0e-23//宏定义
int main()
{
while(1)
{
printf("请输入水的夸脱数:\n");
int water;
scanf("\n%d",&water);
//注意输出 使用到的格式控制符,若精度不够,就出现乱码。这里输出的是十六进制的数
printf("水中包含 %.2e 个水分子\n",(water*950)/water_num);
}
}