题解 | #实现四舍五入#
实现四舍五入
https://www.nowcoder.com/practice/020a0cf673174d5795d97ae79cff59a0
int main(void) { double x; scanf("%lf",&x); if(x>=0) { int a=x+0.5; printf("%d\n",a); } else { int a=x-0.5; printf("%d\n",a); } return 0; }
#题解#
实现四舍五入
https://www.nowcoder.com/practice/020a0cf673174d5795d97ae79cff59a0
int main(void) { double x; scanf("%lf",&x); if(x>=0) { int a=x+0.5; printf("%d\n",a); } else { int a=x-0.5; printf("%d\n",a); } return 0; }
相关推荐