Tsallaka zuwa abun ciki
Justice Tech School

Math Functions

kotlin.math has abs, max, min, pow, sqrt, round, floor, ceil and PI.

Example
import kotlin.math.*
println(abs(-5))
println(max(3, 9))
println(2.0.pow(10))
println(sqrt(16.0))
println(round(2.5))
println(PI)

Exercise

Square root.

(16.0)

Quiz Test

Which import gives these functions?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.