42 lines
1000 B
Java
42 lines
1000 B
Java
import java.util.Scanner;
|
|
|
|
public class LabProgram {
|
|
|
|
public static boolean isArrayEven(int[] arrayValues, int arraySize){
|
|
for (int i = 0; i<arraySize;i++){
|
|
if (arrayValues[i]%2 != 0){
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
public static boolean isArrayOdd(int[] arrayValues, int arraySize){
|
|
for (int i = 0; i<arraySize;i++){
|
|
if (arrayValues[i]%2 == 0){
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
Scanner scnr = new Scanner(System.in);
|
|
int[] myInts = new int[20];
|
|
int numOfInts = scnr.nextInt();
|
|
|
|
for (int i = 0; i<numOfInts;i++){
|
|
myInts[i] = scnr.nextInt();
|
|
}
|
|
if (isArrayEven(myInts, numOfInts)){
|
|
System.out.println("all even");
|
|
}
|
|
else if (isArrayOdd(myInts, numOfInts)){
|
|
System.out.println("all odd");
|
|
}
|
|
else{
|
|
System.out.println("not even or odd");
|
|
}
|
|
}
|
|
}
|
|
|