I am having trouble writing a program that reads a floating point value (double) and prints the closest whole numbers less than and greater than that value. For example, if the number is 28.466, the program would print 28 and 29. I want to use Joptionpane to receive the input from the user
您可以使用Math.floor(x)
和Math.ceil(x)
来获取双x
的下限和上限。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.