Skip to content

Latest commit

 

History

History
22 lines (17 loc) · 435 Bytes

File metadata and controls

22 lines (17 loc) · 435 Bytes

java-program

To find a negative number or positive number in java program

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

int num = 5;

//Conditions to check if the number is negative or positive
if (num > 0)
    System.out.println ("The number is positive");
else if (num < 0)
    System.out.println ("The number is negative");
else
    System.out.println ("Zero");

} }