Check if a given number is equal to 10

Report a typo

Given a number, write a program in Java to determine whether this number is equal to 10 or not. Your program should take a single integer as input and print "Equal" if the number is 10, or "Not Equal" otherwise.

Sample Input 1:

10

Sample Output 1:

Equal

Sample Input 2:

20

Sample Output 2:

Not Equal
Write a program in Java 25
import java.util.Scanner; // Required to read user input

public class Main {
public static void main(String[] args) {

// Create a Scanner object to read input
Scanner scanner = new Scanner(System.in);

// Read input
int num = scanner.nextInt();

// Put your code with ternary operator here
}
}

Create a free account to access the full topic