c语言浮点数转换小数

#include
int main()
{
	float a = 52.3;
	float b;
	b = a * 10.0;
	printf("%f\n", (a * 10.0));
	printf("%f\n", (b));
	printf("%d\n", (int)(a * 10.0));
	printf("%d\n", (int)(b));
}

运行结果:

522.999992
523.000000
522
523

你可能感兴趣的:(c语言,c++,算法)