Computer Science, asked by rehanrajuc7, 4 months ago

write a program to enter a number to count the number of even numbers in the list using an array

Answers

Answered by Anonymous
2

Answer:

Procedure

Declare two integer variables to store odd and even numbers count and initialize them to zero. int odd_count = 0, even_count = 0;

Loop through each element of an array and check whether its odd or even.

if it's odd, increment the odd_count variable by 1.

else, increment the even_count variable by 1.

Answered by divya629
0

Answer:

Please mark me as in brainlist..

Explanation:

Algorithm to count the number of even and odd elements in an array

1. Input the number of elements of the array.

2. Input the array elements.

3. Initialize count_odd = count_even = 0.

4. Traverse the array and increment count_odd if the array element is odd, else increment count_even.

5. Print count_odd and count_even.

Similar questions