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
Which access database object is best to use for the basis of a report when specific criteria must be applied to the report?
Anna007 [38]
The answer is Query.

A query helps a user retrieve specific items from a MS Access database. If you have an item that matches with all the criteria you enter, it shows in the query results. A query is sent to the data source to retrieve the data.




8 0
2 years ago
Read 2 more answers
In case of an emergency, once you or someone already on the scene has contacted 9-1-1, the next thing to do is: A) Move them to
velikii [3]

if alone, you would give care first for which situation

4 0
3 years ago
Read 2 more answers
Players who skate in a crouched position prefer sticks with a low lie. The observation is a type of
Novay_Z [31]
The answer is Qualitative data.  Players who skate in a crouched position prefer sticks with a low lie. The observation is a type of Qualitative data.  Qualitative data<span> is information about qualities; information that can't actually be measured. </span><span> For instance, colors, shapes, and textures of objects are all    </span>qualitative<span> observations. This time, it is the shape of the stick.</span>
6 0
2 years ago
Describe your target audience. You can choose your target audience based on different factors including age, income , education,
Vlad [161]

Answer:

One of the biggest mistakes that budding personal branders make is trying to appeal to everyone. Think about the game of darts: You have to aim in order to hit the board. (If you let your darts go without aiming them, you probably won’t be very popular.) If you hit the board, you score. And if your aim is very good and you hit the bull’s eye, even better!

3 0
3 years ago
The Dash Cell Phone Company charges customers a basic rate of $5 per month to
Ne4ueva [31]

Answer:

Pseudocode is explained below for all cases

Explanation:

* Read Customer_area with robust input for a positive integer with three digits

* Read Customer_phone with robust input a positive integer with seven digits

* Read Customer_text with robust input for positive integers

* print "Basic rate for subscription: $5 per month", set Customer_bill to 5

* select case of

: Customer_text <= 60 print "No extra charge for text messages"

: Customer_text <= 180 print "(Customer_text - 60) * 0.05 extra for text messages", add (Customer_text - 60) * 0.05 to Customer_bill

: Customer_text > 180 print "$6 extra for text messages from 60 - 180, (Customer_text - 180) * 0.10 extra for text messages beyond 180", add (Customer_text - 180) * 0.10 to Customer_bill, add 6 to Customer bill

* print "Bill before taxes is Customer_bill"

* Customer_finalbill = Customer_bill * 1.12

* print "Bill after 12% federal, state and local tax is Customer_finalbill"

4 0
2 years ago
Other questions:
  • How will you identify a file type on your computer? A file type is the standard used to and information in a computer. All file
    14·2 answers
  • How to revive a computer if it functions in an unexpected manner?
    9·1 answer
  • Analyze the following code. // Program 1: public class Test { public static void main(String[] args) { Object a1 = new A(); Obje
    5·1 answer
  • 5. Write few lines of code that creates two arrays with malloc. Then write a statement that can create a memory leak. Discuss wh
    8·1 answer
  • Which statement best justifies the use of a high-speed cache in a CPU?
    11·1 answer
  • Which search engine does not track users? Choose the answer.
    10·2 answers
  • A game developer is purchasing a computing device to develop a game and recognizes the game engine software will require a devic
    7·1 answer
  • A string variable can hold digits such as account numbers and zip codes.<br><br> FALSE<br><br> TRUE
    14·1 answer
  • How many times will line 7 be executed when the following code is run?
    5·1 answer
  • What are the consequences of digital footprint ?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!