c question

.find the number of even numbers repeating
for eg: input:{2,2,3,3,4,4}
output:2

#include<stdio.h>
#include<conio.h>
void main()
{
int n,a[10],count=0,i;
printf(“Enter the no of elements of elements in array”);
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n-1;i++)
if(a[i]%2==0)
count++;
if(a[i]==a[i-1])
count–;
printf(“The count is %d”,count);
getch();
}

1 Like

but here count is coming zero for an array{2,2,3,5,7} answer shud ve cum 1

nice answer!!

1 Like