Comparing two integers: greater, less or equal

Report a typo

Write a program that reads two integers and determines if the first is greater than, less than, or equal to the second. Print '>' if the first integer is greater than the second, '<' if it is less than the second, and '=' if they are equal.

Sample Input 1:

5
3

Sample Output 1:

>

Sample Input 2:

7
7

Sample Output 2:

=
Write a program in Java 17
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

// Read two integers from the user
int num1 = scanner.nextInt();
int num2 = scanner.nextInt();

// TODO: Compare num1 and num2 using relational operators
// 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