Categorize integer as positive, negative, or zero

Report a typo

Write a program that takes an integer as input. If the integer is positive, print 'Positive'. If the integer is negative, print 'Negative'. If the integer is zero, print 'Zero'.

Sample Input 1:

5

Sample Output 1:

Positive

Sample Input 2:

-3

Sample Output 2:

Negative
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 the integer input
int num = scanner.nextInt();

// Use a ternary operator to check if the integer is positive, negative or zero
// and print the corresponding message

}
}
___

Create a free account to access the full topic