1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
topjm [15]
3 years ago
13

Write a C++ program to count even and odd numbers in array. The array size is 50. The array elements will be entered by the user

.
Computers and Technology
1 answer:
vlabodo [156]3 years ago
3 0

Answer:

The program in C++ is as follows:

#include <iostream>

using namespace std;

int main(){

   int numbers[50];

   int evekount = 0, odkount = 0;

   for(int i = 0; i<50;i++){

       cin>>numbers[i];

       if(numbers[i]%2==0){            evekount++;        }

       else{            odkount++;        }

   }

   cout<<"Even Count: "<<evekount<<endl;

   cout<<"Odd Count: "<<odkount<<endl;

   return 0;

}

Explanation:

This declares the integer array of number

   int numbers[50];

This initializes the even count and odd count to 0

   int evekount = 0, odkount = 0;

This iterates from 1 to 50

   for(int i = 0; i<50;i++){

This gets input for the array

       cin>>numbers[i];

This checks for even

<em>        if(numbers[i]%2==0){            evekount++;        }</em>

This checks for odd

<em>        else{            odkount++;        }</em>

   }

This prints the even count

   cout<<"Even Count: "<<evekount<<endl;

This prints the odd count

   cout<<"Odd Count: "<<odkount<<endl;

You might be interested in
Many universities form tight-knit alumni networks, causing the alumni to continue to use each other as a resource for career pla
Dominik [7]

In the case above, this is an example of type of networking as alumni network.

<h3>What’s an alumni network?</h3>

An alumni network is known to be a kind of community of people that are linked as they have attended the same university and therefore, they act to support each other and stay linked to their alma mater.

Therefore, In the case above, this is an example of type of networking as alumni network.

Learn more about networking from

brainly.com/question/1027666

#SPJ1

6 0
2 years ago
What is the first document that colleges review when making admissions decisions
jek_recluse [69]
Usually, the first document colleges check would be SAT or ACT scores
8 0
4 years ago
Read 2 more answers
Which option ensures that a page break is automatically inserted ahead of a specific paragraph or heading?
gulaghasi [49]

The correct answer is option D, the last one! <3

6 0
4 years ago
Read 2 more answers
It destructs microorganisms in containers
Kitty [74]

Answer:

hope you like this ans

Explanation:

using heat in cleaning containers prevents the spread of poisoning and halts the microorganism to multiply and infest the food that will be placed in containers.

5 0
3 years ago
What is a moves track
saveliy_v [14]
It is an activity diary
8 0
4 years ago
Other questions:
  • You are given a network of 10.50.24.0/21, which contains 2,048 addresses. what subnet mask should you use to divide this into fo
    7·1 answer
  • What is an IP address and where I can find the IP address for my computer?
    14·1 answer
  • The data in a database management system that identifies the names of​ tables, fields in each​ table, and the properties of each
    13·2 answers
  • Help me
    14·1 answer
  • Write a program that includes functions to calculate feet to inches, inches to feet, feet to yards, and yards to feet. Then, acc
    9·2 answers
  • NEED BY 15 MINUTES PLEASE! WILL MARK BRAINLIEST!You can create special effects in an image using a camera or a photo-editing too
    5·1 answer
  • Given the integer variables x, y, and z, write a fragment of code that assigns the smallest of x, y, and z to another integer va
    7·1 answer
  • Who is the father of computer?<br>1.Charles Babbage 2.James Waat​
    15·2 answers
  • Write a program to find a perimeter of rectangle using SUB.. ..End SUB​
    14·2 answers
  • Choose the term to complete the sentence.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!