Comparing two integers and determining their relation

Report a typo

Write a Kotlin program that takes two integers from input. Your program needs to determine the relation of the first integer to the second integer. The output should be 'equal' if both integers are equal, 'greater' if the first input is greater than the second, and 'less' if the first input is smaller than the second.

Sample Input 1:

5
3

Sample Output 1:

greater

Sample Input 2:

2
2

Sample Output 2:

equal
Write a program in Kotlin
import java.util.*

fun main(args: Array<String>) {
// Scanner object for reading inputs.
val reader = Scanner(System.`in`)

// TODO: Read two integers from the user.

// TODO: Compare the two integers using Kotlin's relational operators.

// TODO: Print out the outcome of the comparison ("equal", "greater", or "less").
}

Create a free account to access the full topic