int运算,谁说基础不重要?
#include<stdio.h>#define N 10
int main(void)
{
float jieguo = 0;
int fm;
for (fm = 1; fm <= N; fm++)
{
jieguo += 1.0 / fm; \\\此处1.0改为1就无法运行正确结果,求解释
}
printf("%8.6f\n", jieguo);
return 0;
}
#include"stdio.h" int main() { printf("%f\n",1/2); printf("%f",1.0/2); return 0; }