题解 | #四舍五入#
四舍五入
http://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......
int i=(int)d;
if(d-i>0.5){
i=i+1;
}
System.out.printf("%d\n",i);
// System.out.println((int)(d+0.5));
//java中小于1就舍去
//直接加0.5如果大于0.5就直接进一没有大于0,5就舍去
}
}