Count Odd Even
Submissions: 6008   Accuracy:

41.23%

  Difficulty: Easy   Marks: 2
Associated Course(s):   Fork CPP   Placement 100

Congrats on completing Module 1.

In the previous module we learnt about the basics of CPP.  Now, we'll move to more complex stuff. Here, we'll learn about arrays.

Given an array A of N elements. The task is to count number of even and odd elements in the array.

Input:
First line of input contains number of testcases T. For each testcase, there will be two line of input, first line of which contains N and next line contains N array elements.

Output:
For each testcase, print the number of odd elements first and then number of even elements seperated by space in a single line.

User Task:
Your task is to complete the function countOddEven() which should print number of odd and number of even elements in a single line seperated by space.

Constraints:
1 <= T <= 100
1 <= N <= 106
1 <= Ai <= 106

Example:
Input:
1
5
1 2 3 4 5

Output:
3 2

Explanation:
Testcase 1:
In the given array, there are 3 odd elements (1, 3, 5) and 2 even elements (2 and 4).

** For More Input/Output Examples Use 'Expected Output' option **

Author: Dhiman Mayank


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.