Skip to content

Instantly share code, notes, and snippets.

@arielmagbanua
Created September 16, 2021 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arielmagbanua/8e709284777f1893045de6d6dbea698c to your computer and use it in GitHub Desktop.
Save arielmagbanua/8e709284777f1893045de6d6dbea698c to your computer and use it in GitHub Desktop.
Even / Odd / Positive / Negative

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