How to find the Minimum of Three Numbers in Kotlin - Step by Step Examples
How to find the Minimum of Three Numbers in Kotlin ?
Answer
To find the minimum of three numbers in Kotlin, you can use the `minOf` function.
✐ Examples
1 Find Minimum of Three Numbers
In this example,
- We declare three variables
a
,b
, andc
with the numbers to compare. - We use the `minOf` function to compare the numbers and get the minimum.
Kotlin Program
fun main() {
val a = 5
val b = 8
val c = 3
val min = minOf(a, b, c)
println("Minimum of three numbers is: $min")
}
Output
Minimum of three numbers is: 3
Summary
In this tutorial, we learned How to find the Minimum of Three Numbers in Kotlin language with well detailed examples.