#include<stdio.h>
float func(float a) // 四舍五入到小数点后2位
{
return (int)(a*100+0.5)/100.0;
}
int main()
{
float a;
scanf("%f", &a);
func(a);
a = func(a);
printf("%f\n", a);
return 0;
}
Variant f value to two decimal places, to the third decimal rounding operation
Guess you like
Origin blog.csdn.net/huangziguang/article/details/104700858
Recommended
Ranking