Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write the below by c++ This program reads 10 integers and then prints the number of odd and even integers. It also outputs the

Please write the below by c++

This program reads 10 integers and then prints the number of odd and even integers. It also outputs the number of zeros.

The program first prompts the user to specify how many integers are to be read, then the program read the numbers input by the users.

Input

Output -> The integers inputted, the number of zeros, even numbers, and odd numbers.

After reading a number, you need to check whether it is even or odd. Suppose the value is stored in number. Divide number by 2 and check the remainder. If the remainder is 0, number is even. Increment the even count and then check whether number is 0. If it is, increment the zero count. If the remainder is not 0, increment the odd count.

Please create these four functions in your program:

Function initialize Initialize the variable to store input numbers, number of zeros, even numbers, and odd numbers to 0.

Function getNumber Receive the input from the user

Function classifyNumber Classify the input number to zeros, even numbers, and odd numbers

Function printResults Print the integers inputted, the number of zeros, even numbers, and odd numbers.

Sample output:

image text in transcribed

Please enter 10 integers: 5834207391 The numbers you entered are: 5834207391 The number of odd numbers is 6 The number of even numbers is 4 The number of zeros is 1 Please enter 10 integers: 54671209208230 The numbers you entered are: 54671209208230 The number of odd numbers is 3 The number of even numbers is 7 The number of zeros is 3

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management An Organizational Perspective

Authors: Richard T. Watson

1st Edition

0471305340, 978-0471305347

More Books

Students also viewed these Databases questions

Question

What is the purpose of a balance sheet?

Answered: 1 week ago

Question

The difference between a Degree and a Major is

Answered: 1 week ago