Even or Odd

Lab Java Beginner 10 points

Read an integer and print even or odd.

Input

One integer.

Output

One word.

Example

Input

4

Output

even
Sample input available Sample output available
Editor
Java

Hints

Use n % 2 == 0.

Don't test n % 2 == 1: it's -1 for negative odd numbers.

Solution explanation

In Java, -3 % 2 is -1, which is why comparing with 0 is safer.

Show solution
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if (n % 2 == 0) {
            System.out.println("even");
        } else {
            System.out.println("odd");
        }
    }
}
Output
Answer
HOME LEARN COMMUNITY DASHBOARD