C语言如何实现输出浮点数小数点两位(四舍五入法),但若小数点最后位为零则舍去??
C语言如何实现输出浮点数小数点两位(四舍五入法),但若小数点最后位为零则舍去??
日期:2021-03-28 04:26:34 人气:2
#include<stdio.h>
int main()
{float x=12.3456,y=12.344,z=12.303,x1,y1,z1;
x1=((int)((x+0.005)*100))/100.0;
y1=((int)((y+0.005)*100))/100.0;
z1=((int)((z+0.005)*100))/100.0;
printf("