题解 | #取近似值#
取近似值
http://www.nowcoder.com/practice/3ab09737afb645cc82c35d56a5ce802a
#include <stdio.h>
int main(){
float a;
scanf("%f",&a); //强制转换,判断向下取整核实向上取整
printf("%d",(int)(a) + (0.5 <= a - (int)(a)));
return 0;
}
无
无
取近似值
http://www.nowcoder.com/practice/3ab09737afb645cc82c35d56a5ce802a
#include <stdio.h>
int main(){
float a;
scanf("%f",&a); //强制转换,判断向下取整核实向上取整
printf("%d",(int)(a) + (0.5 <= a - (int)(a)));
return 0;
}
无
无
相关推荐