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
Clunker Motors Inc. is recalling all vehicles from model years 1995-1998 and 2004-2006. Given a variable modelYear write a state
DerKrebs [107]

Answer:

((model years >=1995 && model years <= 1998) || (model years >= 2004 && model years <=2006 ) ? no recall= false : no recall = true;

Explanation:

8 0
3 years ago
It's inventiveness uncertainty and futuristic ideas typically deals with science and technology ......what is it.
marshall27 [118]

Answer:

Necessity is the mother of invention, technology is a tool to aid invention, and science is exploratory means to new ideas and information to approach our future with preparedness.All are necessary and need to be balanced and scrutinised.

Explanation:

5 0
3 years ago
a customer is traveling to a branch office, and the network administrator provides her with a static ip address for her laptop.
ser-zykov [4K]

The customer traveling with a provided static IP address should assign the IP in the network adapter settings. Thus, option B is correct.

<h3>What is static IP?</h3>

The complete question is: A customer is traveling to a branch office, and the network administrator provides her with a static IP address for her laptop Which should the customer do to use the static IP address?

A) Run the command "ipconfig configure static"

B) Assign the static IP in network adapter settings

C) Switch the button from dynamic to static on her laptop

D) Disconnect from WiFi and use an Ethernet cable

E) Type the IP address into the browser

A static IP is a setup that is configured manually instead of the DHCP assigned setup. It is a constant and nonchanging IP setup that is used when working remotely.

In the network and sharing system, open the adapter setting and choose the appropriate adapter. Then choose the IPV 4 and check the current internet settings. Choose the desired IP address and then click the OK and save button.

Therefore, option B. static IP is assigned in the network setting option.

Learn more about static IP here:

brainly.com/question/18849429

#SPJ1

7 0
2 years ago
As you're helping a user configure her e-mail over the phone, she remarks that the IP address is different than it was when she
WINSTONCH [101]

Answer:

D. Her computer is a DHCP client.

Explanation:

Since in the question it is mentioned that IP address is different as compared in the previous week also the user did not make any changes with respect to the TCP/IP configuration and the system is working well

So this situation represents that the user computer is a client of DHCP as it deals with the client-server protocol in which it automatically generates the IP i.e Internet protocol along with the IP address

Hence, the correct option is d.

4 0
4 years ago
The expressionvecCont.empty() empties the vector container of allelements.
Semenov [28]

Answer:

False

Explanation:

vector is like a dynamic array that has a special ability to resize automatically when it required.

vector has several functions:

like, insert() to insert the element in the vector.

delete() for delete the one element at a time.

empty() is also the function used in the vector. It is used for checking the vector is empty or not.

it gives the Boolean value (TRUE or FALSE), if the vector is empty it gives the output TRUE if the vector is not empty it gives the output FALSE.

It is not used for empty or deletes all elements of the vector.

Therefore, the answer is False.

4 0
3 years ago
Other questions:
  • What function does a mobile device’s accelerometer serve?
    8·2 answers
  • After installation of SSL certificate website asking for username and password.
    6·1 answer
  • What is an optimal Huffman code for the following set of frequencies, based on the first 8 Fibonacci numbers?
    8·1 answer
  • How can the storage model assist in the design of storage networks?
    12·1 answer
  • Dereck works for long hours on his computer. He frequently experiences physical strain by the end of the day because he does not
    8·2 answers
  • All banks follow the same guideline for determining if an applicant qualifies for a loan.
    13·1 answer
  • By dividing the control plane from the data plane, SDN offers the flexibility to view the entire data plane infrastructure as a
    11·2 answers
  • a) In an office, it is required to take hundreds of copies of the same type written document. Which traditional method of docume
    11·1 answer
  • One of the difficult things about working in game design is that while there are many different roles, most of them only match o
    15·1 answer
  • What causes the hidden node problem in a wireless local area network (wlan)?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!