Question
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:
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 3Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started