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
Is jesus dead or alive
Morgarella [4.7K]

Answer:

Explanation:

i think he alive but in heaven i dunno

8 0
3 years ago
What is an allocation unit?
sdas [7]
It is a unit of disk space allocation for files and directories. Hope this helps :) 
5 0
3 years ago
I will mark you as BRAINLIEST if you give me the correct answer of the questions... Pls asap with all details i am time limited
Alex_Xolod [135]

Answer:

11. 1million square decimetres (from online)

20. assuming room is rectangular,

length= (p - 2b)/2

because perimeter= 2 length + 2 breadth for rectangular

6 0
2 years ago
Read 2 more answers
Problem statement: Using loop, write a program that will ask the user to enter a character for left or right. Then, the user wil
zvonat [6]
Define variables
left is l
right is r

Ask input
left or right

Ask input value

Equate l or r to the input value

Show ladder with steps equal to input value and in the side of input variable
7 0
3 years ago
What responds to both visual appeal and functional needs? (1 point) A.) applied art B.) performance art C.) fine art D.) visual
d1i1m1o1n [39]

Answer:

a

Explanation:

6 0
3 years ago
Other questions:
  • A ______________ is a document created when planning resource management to help promote teamwork and clarify team communication
    13·1 answer
  • BI systems have eliminated a common organizational problem, which is simultaneously having too much data but somehow not enough.
    14·1 answer
  • What will happen when a user attempts to login to salesforce from an ip address that is outside the login ip range on the user's
    15·1 answer
  • to add data to to a chart, you must format data from another microsoft office product, that automatically opens. whats the name
    10·1 answer
  • Who can help me on my school we will to google meet and i share my screen
    5·1 answer
  • User can use ______ commands to search for and correct words in a document
    13·1 answer
  • highlight the possible risks and problems that should be address during the implementation of information system process
    5·1 answer
  • Applications of kinematics in computer engineering​
    7·1 answer
  • The spreadsheet below shows how much money each store raised for charity during the months of January, February, and March. A1:
    8·2 answers
  • CODEHS: WHY is it important to know the difference between div and span?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!