belongs to collection: Kotlin programming Exercises
How to get average of the given array elements in Kotlin
doubleArrayOf(2.5, 1.8, 3.4)
Solution:
fun main(args : Array<String>) { val x = doubleArrayOf(2.5, 1.8, 3.4) val y = x.average() println(y) }
Output:
2.5666666666666664
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Solution:
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer2.5666666666666664