-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1074-Par-ou -Impar.java
More file actions
39 lines (29 loc) · 993 Bytes
/
Copy path1074-Par-ou -Impar.java
File metadata and controls
39 lines (29 loc) · 993 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
int numero;
Scanner scanner = new Scanner(System.in);
int vezes = scanner.nextInt();
for (int i = 0; i < vezes; i++) {
numero = scanner.nextInt();
Resultado(numero);
}
}
public static void Resultado(int numero) {
if (numero == 0) {
System.out.println("NULL");
} else if (numero % 2 != 0){ // IMPAR -> ODD
if(numero<0){ // NEGATIVO
System.out.println("ODD NEGATIVE");
}else{ // POSITIVO
System.out.println("ODD POSITIVE");
}
} else if (numero % 2 == 0) { // PAR -> EVEN
if(numero<0){// NEGATIVO
System.out.println("EVEN NEGATIVE");
}else{ // POSITIVO
System.out.println("EVEN POSITIVE");
}
}
}
}