Hacking the Matrix

Report a typo

Neo is trying to hack the Matrix. He has a list of codes, but to solve this challenge, he must create a function called matrix from a list of integers and a parameter called code. It must return the sum of the elements that are divisible by this code.

val listOfInt = listOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
val code = 5
println(listOfInt matrix code)

Sample Input 1:

1 2 3 8 10 10 11 13 5
2

Sample Output 1:

30
Write a program in Kotlin
// complete the definition
/*?*/.matrix(code: Int): Int {
// write the rest of the code
}
___

Create a free account to access the full topic