/***************************************************************
Program to find the count of even or odd elements in the array
***************************************************************/
#include<stdio.h> // include stdio.h library
#define MAX 5
int main(void)
{
int arr[MAX] = {1, 5, 9, 14, 200};
int even_count = 0, odd_count = 0; // variables to store even or odd count
// iterate over the arrays
for(int i = 0; i < MAX; i++)
{
// check for even number
if(arr[i] % 2 == 0)
{
even_count++;
}
else
{
odd_count++;
}
}
printf("Even elements = %d\n", even_count);
printf("Odd elements = %d", odd_count);
return 0; // return 0 to operating system
}