You are given an array of integers. Your task is to double each number in the array. Fill the blanks in given Kotlin code to solve this task. The array is represented as MutableList in Kotlin. Keep in mind that in Kotlin, you could use 'for' loop and index to access and modify elements in MutableList.
For loop and lists
Doubling each number in an array
Report a typo
Fill in the gaps with the relevant elements
fun main() {
val numbers = (1, 2, 3, 4, 5)
(i numbers.) {
numbers[i] = numbers[i] * 2
}
print(numbers.joinToString(", "))
}Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.