Given two numbers, determine if the first number is greater than, less than, or equal to the second number. Print '>' if the first number is greater than the second, '<' if it is less than the second, or '=' if they are equal.
Comparing numbers. Relational operators
Compare two numbers with symbols
Report a typo
Sample Input 1:
5
3Sample Output 1:
>Sample Input 2:
2
7Sample Output 2:
<Write a program in Kotlin
import java.util.Scanner
fun main() {
val scanner = Scanner(System.`in`)
// Read the two numbers
val num1 = scanner.nextInt()
val num2 = scanner.nextInt()
// TODO: Compare the two numbers and print the result
// Use the relational operators (<, >, ==) to compare num1 and num2
// Print '>' if num1 is greater than num2
// Print '<' if num1 is less than num2
// Print '=' if num1 is equal to num2
}
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.