+ 2

I'd appreciate some help rounding down a Double the nearest Int please help

fun main(args: Array<String>) { var area:Double var side = 10.5 area = side * side print(area) } I'd like this to print out 110 and not 110.25

14th May 2022, 5:22 AM
Mikey
6 Antworten
+ 2
Try print(Math.floor(area)) You can also do a search online to find our about it.
14th May 2022, 6:23 AM
Ausgrindtube
Ausgrindtube - avatar
+ 1
use math.floor( )
14th May 2022, 5:56 AM
Chris Coder
Chris Coder - avatar
+ 1
idk where to put the Math.floor()
14th May 2022, 6:01 AM
Mikey
+ 1
What programing language are you using?
14th May 2022, 6:23 AM
Chris Coder
Chris Coder - avatar
+ 1
Im using kotlin
14th May 2022, 6:25 AM
Mikey
+ 1
Hmm. sorry. Try println(Math.round(area))
14th May 2022, 6:35 AM
Chris Coder
Chris Coder - avatar