Answer to Question #257858 in C++ for Ae Dion

Question #257858

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);

}


1
Expert's answer
2021-10-28T06:59:08-0400
#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);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS