#include <stdio.h>
int main()
{
float a,b,c,d;
double result;
a = 1;
b = 2;
c = 3;
d = 4;
result = a + b- c/d; //在这里体验哦~
printf("%.f\n", result);
return 0;
}
请问为什么结果是2啊,我明明ABCD是用float定义的
%f 输出而不是 %.f,
为什么要用float定义啊?abcd不是就该用int的吗?虽然这样结果不止小数
我明白了,是应该用%f输出而不是 %.f吧