题解 | #实现四舍五入#
实现四舍五入
http://www.nowcoder.com/practice/020a0cf673174d5795d97ae79cff59a0
#include<stdio.h> int main () { float fl; int b =0; scanf ("%f",&fl); if(fl>0) { b=fl+0.5; printf("%d",b); } else { b=fl-0.5; printf("%d",b); } return 0; }
实现四舍五入
http://www.nowcoder.com/practice/020a0cf673174d5795d97ae79cff59a0
#include<stdio.h> int main () { float fl; int b =0; scanf ("%f",&fl); if(fl>0) { b=fl+0.5; printf("%d",b); } else { b=fl-0.5; printf("%d",b); } return 0; }
相关推荐