题解 | #四舍五入#
四舍五入
https://www.nowcoder.com/practice/cae89de6292b4084acb93659353260e0
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double d= scanner.nextDouble();
//write your code here......
//round()方法接收float类型的参数,返回int类型的参数,所有强转放在方法里面
int i = Math.round((float)d);
System.out.println(i);
}
}

查看3道真题和解析