Checking if one integer is greater than another

Report a typo

Consider a simple program where you have two integer variables: num1 is assigned the value 10 and num2 is assigned the value 5. You are tasked to determine if num1 is greater than num2 and print a message stating whether it's true or false. However, the code lines to perform this task have been jumbled. Your job is to reorder the lines of code to get the intended output.

Reorder lines using drag or arrows. Adjust indentation with left buttons
                println("Is $num1 greater than $num2? $result")
              
                fun main() {
              
                }
              
                val num2 = 5
              
                val num1 = 10
              
                val result = num1 > num2
              

Create a free account to access the full topic