在C语言计算出的结果中怎么保留小数点后两位

来源:学生作业学帮网 编辑:学帮网 时间:2024/06/25 03:03:16

在C语言计算出的结果中怎么保留小数点后两位

比如
float a = 23.456789;
printf("%.2f",a); //输出为23.45