题解 | #取近似值#
取近似值
https://www.nowcoder.com/practice/3ab09737afb645cc82c35d56a5ce802a
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); double num = in.nextDouble(); // 加上0.5之后,强行去掉小数部分,即为四舍五入后的数 System.out.println((int) (num + 0.5)); } }