You are given a number as the input. Your task is to determine whether it is a positive integer, negative integer, zero or a non-integer. If the integer is positive, print 'positive'. If it is negative, print 'negative'. If the integer is zero, print 'zero'. If it is a non-integer, print 'non-integer'.
Primitive and reference types
Determine the type of the input number
Report a typo
Sample Input 1:
5Sample Output 1:
positiveSample Input 2:
-20Sample Output 2:
negativeWrite a program in Java 17
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// Create a Scanner object
Scanner sc = new Scanner(System.in);
// Place your code here
sc.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.