You are given a number N. If N is positive print 'Positive', if N is negative print 'Negative', and if N is zero, print 'Zero'.
Conditional statement
Determine if a number is positive, negative or zero
Report a typo
Sample Input 1:
5Sample Output 1:
PositiveSample Input 2:
-3Sample Output 2:
NegativeWrite a program in Java 17
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// Create a new Scanner object for reading the input
Scanner scanner = new Scanner(System.in);
// Read the number N
int N = scanner.nextInt();
// Your code goes here
// Important: Remember to close the scanner!
scanner.close();
}
}
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.