Skip to content

Instantly share code, notes, and snippets.

@arielmagbanuazeald
Last active September 16, 2021 07:07
Show Gist options
  • Save arielmagbanuazeald/19859560fe1def4e973a036b475b9f94 to your computer and use it in GitHub Desktop.
Save arielmagbanuazeald/19859560fe1def4e973a036b475b9f94 to your computer and use it in GitHub Desktop.
EvenOddPositiveNegative

Even / Odd / Positive / Negative

Create a program that can identify of a integer is even or odd and if it is positive or negative.

Starter Code

public class App {
    public static void main(String[] args) throws Exception {
        // scanner
        Scanner scanner = new Scanner(System.in);

        // get the number input
        
        // test and print if even or odd
        
        // test and print if positive or negative

        scanner.close();
    }
}

Outputs

Enter a number: 4
4 - Even
4 - Postive
Enter a number: -4
-4 - Even
-4 - Negative
Enter a number: -35
-35 - Odd
-35 - Negative
Enter a number: 53
53 - Odd
53 - Positive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment