1import java.util.Scanner;
2public class EvenOddArray
3{
4 public static void main(String[] args)
5 {
6 int numbers;
7 Scanner sc = new Scanner(System.in);
8 System.out.print("Please enter elements in array : ");
9 numbers = sc.nextInt();
10 int[] arrNum = new int[numbers];
11 System.out.println("Enter " + numbers + " elements : ");
12 for(int a = 0; a < numbers; a++)
13 {
14 arrNum[a] = sc.nextInt();
15 }
16 // print odd numbers
17 System.out.print("Odd numbers : ");
18 for(int a = 0 ; a < numbers ; a++)
19 {
20 if(arrNum[a] % 2 != 0)
21 {
22 System.out.print(arrNum[a] + " ");
23 }
24 }
25 System.out.println("");
26 // print even numbers
27 System.out.print("Even numbers : ");
28 for(int a = 0 ; a < numbers ; a++)
29 {
30 if(arrNum[a] % 2 == 0)
31 {
32 System.out.print(arrNum[a] + " ");
33 }
34 }
35 sc.close();
36 }
37}