Q:

How to get average of the given array elements in Kotlin

0

How to get average of the given array elements in Kotlin

doubleArrayOf(2.5, 1.8, 3.4)

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Solution:

fun main(args : Array<String>)  {  
	val x = doubleArrayOf(2.5, 1.8, 3.4)
	val y = x.average()
	println(y)
}

Output:

2.5666666666666664

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now