import java.util.Scanner;
public class EvenOddArray {
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
System.out.println("ENTER THE LENGTH OF AN ARRAY:");
int n = scan.nextInt();
System.out.println("ENTER THE ARRAY:");
int arr[] = new int[n];
for (int i=0; i< n ;i++ ){
arr[i] = scan.nextInt();
}
System.out.println("EVEN NUMBERS ARE:");
for(int i =0 ; i<n ; i++){
// WE ARE NOW CHECKING EVEN ODD NUMBERS
if(arr[i]%2==0){
System.out.print(arr[i]+" ");
}
System.out.println();
System.out.println("ODD NUMBERS ARE:");
for(int j=0 ; i< n ; i++){
if (arr[i] %2 != 0){
System.out.print(arr[i]);
}
}
}
Comments
Post a Comment