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
How can I code this in Python with only if-statements? (Only allowed to use the built-in functions int(), float(), and str().)
yan [13]

str)float)sorry dont know

5 0
3 years ago
What is a Computer ?and it's demerits​
kherson [118]

Answer:

Computer has making human life faster because of its incredible speed,Accuracy and storage, with which human can save anything and search it out easily when needed. We can say computer a versatile machine because it is very flexible in performing their jobs.

6 0
3 years ago
Read 2 more answers
The ________ view in access looks similar to an excel spreadsheet.
ch4aika [34]
Datasheet 
<span>The datasheet view in access looks similar to an excel spreadsheet.</span>
6 0
3 years ago
GoInternet, Inc., is an Internet-access service provider that is being forced to manage numerous unwanted e-mail messages from a
marissa [1.9K]

Answer:

The correct answer to the following question is option b.)sends messages involving products of companies previously sued under the CAN-SPAM Act.

Explanation:

This act is an act of Controlling the Assault of Non-Solicited Marketing And Other things.

It is the law that establish the rules for the commercial message and the commercial e-mails, gives recipients right to have the business stops emailing them, and they outline the penalties incurred for those person who has violated the law.

8 0
3 years ago
What is the full form of html​
zepelin [54]

Answer:

Hypertext Markup Language

Explanation:

Hypertext Markup Language

5 0
2 years ago
Read 2 more answers
Other questions:
  • Easy STEAM question :)
    15·2 answers
  • How many slides should a presentation include?
    11·2 answers
  • The icons to insert footnotes and endnotes in a document are located in the _____ tab.
    8·1 answer
  • zeroIt is a function that takes one argument and returns no value. The function stores the value 0 back into the parameter. x is
    8·1 answer
  • The rule of thumb that predicts that the number of transistors on a cpu will double every two years is called ________ law.
    7·1 answer
  • Name similarities between innovation and invention
    6·1 answer
  • . Write a swift programming code to perform following tasks a) Declare a variable that stores the age of a person b) Declare a c
    5·1 answer
  • When you check your hard drive to see how much space is available, you are checking your
    15·1 answer
  • 2. How much did John Jones have in his account on the first day of the
    5·1 answer
  • 4. Compute the following additions
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!