Question: Write a Kotlin program to calculate the average using arrays and loops: Solution: fun main ( args: Array ) { / / declaring an array
Write a Kotlin program to calculate the average using arrays and loops:
Solution:
fun mainargs: Array
declaring an array of doubles using initial values
val myArray doubleArrayOf
var sum
for i in myArray
sum i
val averagesummyArraysize
printlnThe average is: fformataverage
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
