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
HTTP is the protocol that governs communications between web servers and web clients (i.e. browsers). Part of the protocol inclu
frutty [35]

Answer:

A switch statement is a set of different outputs depending on the number of criteria asked to follow.

Given an integer number as a variable status, the algorithm would state as the following:

       int num

       switch (num) {

           case 200:

               printf(OK);

               break;

           case 403:

               printf(Fobidden);

               break;

           case 404:

               printf(Not Found);

               break;

           case 500:

               printf(Server Error);

               break;

           default:

               printf(Not a proper value);

               break;

       }

Depends on the value of hte variable "num", it will fall in one of the options above. If the variable has a different value that doesn't fit in any of the options above, it will prompt the default message.

4 0
3 years ago
One of the most notable impacts of IT on business is improved
Igoryamba

One of the most notable impacts of IT on business is improved efficiency  of security communication.

<h3>What is security communication?</h3>

Security Communication Systems are said to be a vital aspect or part of works as well as in security mitigation measure.

The use of security communication in any organization is known to be the use of security tools to be able to keep the organization safe from any form of attack.

Note that One of the most notable impacts of IT on business is improved efficiency  of security communication as it boast security of data.

Learn more about security communication  from

brainly.com/question/25720881

#SPJ1

8 0
2 years ago
I will mark brainillist if someone answers Donethkm question its How can a Word user insert a page break into a document to isol
zloy xaker [14]

Answer:

Open the dialog box.

Select the tab.

Select the tab.

Explanation:

cause

8 0
4 years ago
Read 2 more answers
In ipv4 addressing, an ip address whose first octet is in the range of 192–223 belongs to a class ____ network.
pishuonlain [190]

I guess the correct answer is class C network.

In IPv4 addressing, an IP address whose first octet is in the range of 192–223 belongs to a class C network.

4 0
3 years ago
Which aspect of nature inspired the invention of Velcro
lesya692 [45]

Burrs from plants (APEX)

8 0
4 years ago
Other questions:
  • Aubrey didnt like to use graphics or images on her slides. She preferred to use only a title for her slides and bullet-poinged t
    14·2 answers
  • In order for two computers to communicate via the internet, they must first locate one another. How do computers locate one anot
    12·1 answer
  • Write down the pseudo code of a program that calculates the Body Mass Index (BMI) of
    9·1 answer
  • Build a state diagram for the “book” based upon the following information of the library.
    6·1 answer
  • Describe three types of physical storage currently used. what usage scenarios would be ideal for each?
    7·1 answer
  • Why would you group data in a report? SQL
    9·1 answer
  • &gt;&gt;&gt; from hog import *
    15·1 answer
  • There will be 10 numbers stored contiguously in the computer at location x 7000 . Write a complete LC-3 program, starting at loc
    14·2 answers
  • Post as a reply your example of "data, which is processed into information" case - examples should not necessarily be related to
    13·1 answer
  • Free points <br><br><br><br><br> also if u wanna check out my spotlfy u can (xkuromist)
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!