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]
2 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]2 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
How do u set up a Wi-Fi network on Android ​
AlladinOne [14]

Answer:

These are some way I know

5 0
2 years ago
3. This shows you the different things that all the tools can do, as you click on the tools
leva [86]
D that’s the answer I learn that in my old school
7 0
3 years ago
Can i get local search results based on my location
almond37 [142]
Yes, your search results are based on your location, if you allow safari to use your location (phone)
8 0
3 years ago
To figure out how to use her MacBook Pro graphics software to update designs originally created on a DEC10, Marianne needs to us
mina [271]

Answer:

Glue Language

Explanation:

I'm not 100% sure, but here is the definition.

Glue language- A programming language that can be used to provide interoperability between systems not originally intended to work together

6 0
3 years ago
What is land? Explain its features​
egoroff_w [7]

Answer:

Odd question but okay....

Explanation:

Earth's surface, also known as "Land", has very many biotic(animals) and abiotic factors (plants). There are also a wide variety of land features such as mountain, plains, Hills, etc..

Within these features are small - Large ecosystems we're plants and animals thrive to create a bigger and stronger wildlife.

"Land" is a very simple word that stands for all of the different plants, mammals, ecosystems, aquatic animals and many more ways of life on Land.

I hope this helps...

3 0
2 years ago
Other questions:
  • You are preparing to program a replacement system board, but the "system is booting in mpm mode" message is not displayed. what
    10·2 answers
  • In a relational database, the three basic operations used to develop useful sets of data are:
    10·1 answer
  • Which of the following STEM discoverers is known for creating complex computational physics to develop computer models to simula
    7·1 answer
  • What happens when the following code segment executes if test.txt does not exist?:<br> A,B,C,D?
    7·1 answer
  • What items do you keep in a data base
    5·1 answer
  • Digital certificates can be used for each of these EXCEPT _____. A. to encrypt channels to provide secure communication between
    13·1 answer
  • A device that make it possible for a muitiple customer to share one address is called
    13·1 answer
  • IN C++ PLEASE!!!! Define a function FilterStr() that takes a string parameter and returns "Good" if the character at index 4 in
    7·1 answer
  • What are some positive and nevative aspects of technology?
    11·1 answer
  • A(n) ________ is a program that takes advantage of very low-level operating system functions to hide itself from all but the mos
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!