countoddevendifference
#include <stdio.h>
int countOddEvenDifference(int n, int arr[])
{
int odd = 0, even = 0;
for(int i=0; i<n; i++)
{
if(arr[i]%2==0)
{
even = even+1;
}
else
{
odd = odd+1;
}
}
return odd - even;
}
int main()
{
int n;
scanf("%d",&n);
int array[n];
for(int i=0; i<n; i++)
{
scanf("%d",&array[i]);
}
int result = countOddEvenDifference(n, array);
printf("%d",result);
return 0;
}
Siddhant