具体四舍五入怎么辨别还需要学习,等我明白了回来更新
但不是四舍五入很确定可以看下面
#include<stdio.h>
//不是四舍五入
int main()
{
printf("%f\n", 100.00);//100.000000
printf("%.0f\n", 100.00);//100
printf("1\n");
printf("%f\n", 100.30);//100.300000
printf("%.0f\n", 100.30);//100
printf("2\n");
printf("%f\n", 100.50);//100.500000
printf("%.0f\n", 100.50);//100
printf("3\n");
printf("%f\n", 100.53);//100.530000
printf("%.1f\n", 100.53);//100.5
printf("4\n");
printf("%f\n", 100.55);//100.550000
printf("%.1f\n", 100.55);//100.5
printf("5\n");
printf("%f\n", 100.56);//100.560000
printf("%.1f\n", 100.56);//100.6
printf("6\n");
printf("%f\n", 100.563);//100.563000
printf("%.2f\n", 100.563);//100.56
printf("7\n");
printf("%f\n", 100.565);//100.565000
printf("%.2f\n", 100.565);//100.56
printf("8\n");
printf("%f\n", 100.566);//100.566000
printf("%.2f\n", 100.566);//100.57
printf("9\n");
return 0;
}