Given an array of integers, Print the number of even and odd elements in an array
For example:
If the input is
1 2 3 4 5
Then the results is
For example:
If the input is
1 2 3 4 5
Then the results is
has 3 odd elements & 2 even elements
Implementation:
#include <stdio.h>
int main(void) {
 int *a,n,i,oddcount=0,evencount=0;
 scanf("%d",&n);
 a=(int*)malloc(sizeof(int)*n);
 for(i=0;i<n;i++)
 {
  scanf("%d",(a+i));
  if(*(a+i)&1)
  oddcount++;
  else
  evencount++;
 }
 for(i=0;i<n;i++)
 printf("%d ",*(a+i));
 printf("\nhas %d odd elements & %d even elements",oddcount,evencount);
 return 0;
}