Computer Science, asked by moonlitfeathers, 7 months ago

write a program to accept 20 integer numbers in a Single Dimensional Array. Find and display the number of even numbers​

Answers

Answered by Anonymous
4

Answer:

Hi...

It's a python code..

Explanation:

Hope it helps you..

Please mark brainliest..

Attachments:
Answered by Anonymous
1

Answer:

// CPP program to count number of even

// and odd elements in an array

#include<iostream>

using namespace std;

void CountingEvenOdd(int arr[], int arr_size)

{

int even_count = 0;

int odd_count = 0;

// loop to read all the values in the array

for(int i = 0 ; i < arr_size ; i++)

{

// checking if a number is completely

// divisible by 2

if (arr[i] & 1 == 1)

odd_count ++ ;

else

even_count ++ ;

}

cout << "Number of even elements = " << even_count

<< "\nNumber of odd elements = " << odd_count ;

}

// Driver Code

int main()

{

int arr[] = {2, 3, 4, 5, 6};

int n = sizeof(arr) / sizeof(arr[0]);

CouningEvenOdd(arr, n);

}

Similar questions