题解 | #取近似值#
取近似值
https://www.nowcoder.com/practice/3ab09737afb645cc82c35d56a5ce802a
#include <stdio.h>
int main() {
float x;
scanf("%f",&x);
float temp=0.0;
for(float i=1.0;i<x;i++)
temp+=1.0;
x=x-temp;
if(x>=0.5)
printf("%d",(int)(temp+1));//类型转换
else
printf("%d",(int)(temp));
}