Recheck this code and show the correct code
int countEvent(int a[], int size)
{
int x= 0;
for (int i = 0; i < n; i++)
{
if (a[i] % 2 == 0 ){
}
}
return(x);
}
#include<iostream>
using namespace std;
int countEvent(int a[], int size)
{
int x= 0;
for (int i = 0; i < size; i++)
{
if (a[i] % 2 == 0 ){
x++;
}
}
return(x);
}
int main(){
int a[]={1,2,3,4,5,6};
cout<<countEvent(a,6);
}
Comments
Leave a comment