Program in Java to check whether the given integer is positive or negative
import java.util.*;
public class Learner{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int num=sc.nextInt();
System.out.println("Enter a number:");
if (num > 0){
System.out.println(" is a positive number"+num);
}
else if (num < 0){
System.out.println(" is a negative number"+num);
}
else{
System.out.println("0 is neither positive nor negative");
}
}
}
OUTPUT 1
Enter a number:
0
0 is neither positive nor negative