#include <stdio.h>
#define MAX_SIZE 100 //Maximum size of the array
int main()
{
int arr[MAX_SIZE];
int i, size, even, odd;
/* Input size of the array */
scanf("%d", &size);
/* Input array elements */
for(i=0; i<size; i++)
{
scanf("%d", &arr[i]);
}
/* Assuming that there are 0 even and odd elements */
even = 0;
odd = 0;
for(i=0; i<size; i++)
{
/* If the current element of array is even then increment even count */
if(arr[i]%2 == 0)
{
even++;
}
else
{
odd++;
}
}
printf("%d\n", even);
printf("%d", odd);
return 0;
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.