Comparing two integers with basic relational operators

Report a typo

You are given two integers 'a' and 'b'. One per line in this order. Your goal is to compare these integers using the basic relational operators and print all results that are true. If 'a' is greater than 'b' print 'Greater'. If 'a' is less than 'b' print 'Less'. If 'a' equals 'b' print 'Equal'. Make sure to evaluate all these conditions for the given integers.

Sample Input 1:

1
2

Sample Output 1:

Less

Sample Input 2:

3
3

Sample Output 2:

Equal
Write a program in Java 25
import java.util.Scanner;

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

// read the first integer
int a = scanner.nextInt();

// read the second integer
int b = scanner.nextInt();

// Perform the comparison of a and b

// compare if value of a is more than b

// compare if value of a is less than b

// compare if value of a equals b
}
}

Create a free account to access the full topic