URI Problem (Even or Odd) 1074 Solution in Java

Problem Solving, URI

URI Problem (Even or Odd) 1074:
Even or Odd is a basic problem on URI online judge for novice problem solver.
You can find details on this Link.

import java.util.Scanner;

/**
 * @Author : Muhammad Harun-Or-Roshid
 * @Date : Oct 14, 2016
 * @Time : 10:47:52 PM
 */
public class Uri1074 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if (n < 10000) {
            for (int i = 0; i < n; i++) {
                int x = sc.nextInt();
                if (x > -10000000 && x < 10000000) {
                    if (x == 0) {
                        System.out.println("NULL");
                    } else if (x % 2 == 0) {
                        if (x > 0) {
                            System.out.println("EVEN POSITIVE");
                        } else {
                            System.out.println("EVEN NEGATIVE");
                        }
                    } else if (x > 0) {
                        System.out.println("ODD POSITIVE");
                    } else {
                        System.out.println("ODD NEGATIVE");
                    }
                }
            }
        }
    }
}

0 Comments

You may find interest following article