You're working on a basic Kotlin program and need to fill in some missing types. You are given two variables, a and b, and you have already declared the type for the result variable as Double. The operation performed is addition. Determine the correct types for a and b that would allow this code to run successfully, while obeying Kotlin's type system and arithmetic operations.
When different types meet: type coercion
Determining variable types for addition operation
Report a typo
Fill in the gaps with the relevant elements
fun main() {
val a: = 10
val b: = 20.5
val result: Double = a + b
println("The result of $a plus $b equals $result")
} ___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
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.