Print even and odd numbers
Single File Programming Question
Problem Statement
Alex is working on a number classification project. He needs to write a program that reads an array of integers, classifies them into even and odd numbers, and then prints the array elements.
Help Alex as he wants to use a class and objects to implement this program. The class should be named NumberClassifier.
Input:
format :The first line of input consists of an integer n, representing the number of elements in the array.
The second line consists of n space-separated integers, representing the array elements.
Output:
format :The first line of output prints "Even numbers:".
The second line prints the even numbers from the given array, separated by a space.
The third line prints "Odd numbers:".
The fourth line prints the odd numbers from the given array, separated by a space.
Refer to the sample output for formatting specifications.
Code constraints : The given test cases fall under the following constraints:
3 ≤ n ≤ 10
1 ≤ element ≤ 1000
There is at least one odd and one even digit in the input array given
Sample test cases :
Input 1:
5
9 2 11 4 8
Output 1 :
Even numbers:
2 4 8
Odd numbers:
9 11
Input 2 :
10
6 2 4 3 7 13 11 10 15 22
Output 2 :
Even numbers:
6 2 4 10 22
Odd numbers:
3 7 13 11 15