Computing an arithmetic operation and printing the result

Report a typo

In Kotlin, you need to compute the result of a mathematical operation involving two variables. You are given the values of two variables at initialization and an arithmetic operation that increases the value of one of the variables by 1, then multiplies it by 2. Your task is to reorder the lines of provided code in a way that performs this operation and prints the result to the console.

Reorder lines using drag or arrows. Adjust indentation with left buttons
                fun main() {
              
                var x = 5
              
                println("Result: $y")
              
                x++
              
                val y = x * 2
              
                }
              

Create a free account to access the full topic