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.
Comparing numbers. Relational operators
Comparing two integers and determining their relation
Report a typo
Sample Input 1:
5
3Sample Output 1:
greaterSample Input 2:
2
2Sample Output 2:
equalWrite 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
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.