题解 | #实现四舍五入#
实现四舍五入
https://www.nowcoder.com/practice/020a0cf673174d5795d97ae79cff59a0
#include <iostream>
using namespace std;
#include<math.h>
int main() {
double d;
cin >> d;
// write your code here......
int a;
a=d;
if(fabs(a-d)>0.5)
{
cout<<(d>0?a+1:a-1)<<endl;
}
else
cout<<a<<endl;
return 0;
}
