Write a program that reads a list of integers

Assignment Help Programming Languages
Reference no: EM132248221

Question: Write a program that reads a list of integers, and outputs whether the list contains all even numbers, odd numbers, or neither. The input consists of five integers.

Ex: If the input is 2 4 6 8 10, the output is:

all even

Ex: If the input is 1 3 5 7 9, the output is:

all odd

Ex: If the input is 1 2 3 4 5, the output is:

not all even or all odd

Your program should define and use two functions:

Function countEvensInArray(integer array(?) userVals) returns integer numEven

Function countOddsInArray(integer array(?) userVals) returns integer numOdd

countEvensInArray should return 5 if all integers in the array are even. countOddsInArray should return 5 if all integers in the array are odd.

Reference no: EM132248221

Questions Cloud

Recommendations for improvement det diversity policy : Anyone can hep to make recommendations for improvement DET Diversity Policy
Discuss new skills you acquired from the class : Base on the course content, discuss new skills you acquired from this class? How relevant are the new skills to your current and/or future profession?
Describe how the data is displayed : Kirk (2016) tells us that data adjustments affects what data is displayed and presentation adjustments affects how the data is displayed.
Benefits of using earned value management in projects : Explain five benefits of using Earned Value Management in Projects. Outline the marketing opportunities in BRIC countries.
Write a program that reads a list of integers : Write a program that reads a list of integers, and outputs whether the list contains all even numbers, odd numbers, or neither.
Flow-time efficiency of patient for major treatment : What percentage is the flow-time efficiency of a patient for major treatment? what is the average waiting time (in minutes) to be seen by a dentist?
What is the history of the case : Possible questions to answer would be: Who is the plaintiff? The defendant? The appellant? The appellee?
Identify a case study with an appropriate situation : Research the web and identify a case study with an appropriate situation related to penetration testing or hacking for or against a business, organization.
Honest and transparent with dealings : Toms is a brand that has established itself as humanitarian. Whether the brand takes anything away from other shoe manufacturers

Reviews

Write a Review

Programming Languages Questions & Answers

  Implement an autoincrement operator for variables

CSC8503 Principles of Programming Languages Assignment. Implement an autoincrement operator for variables. Implement a do ... until post-tested loop

  Writes a function that takes a list of integers

Using ML writes a function that takes a list of integers as argument and returns a pair consisting of the sum of the even position and the sum of the odd positions of the list. You should not use auxiliary functions

  Find the error in the given pseudocode

If the following pseudocode were an actual program, why would it not display the output that the programmer expects? Declare String favoriteFood Display "What is the name of your favorite food?" Input favoriteFood Display "Your favorite food is " ..

  Write program which prompts user to input integer

Write a C++ program which prompts user to input the integer and then ouputs both individual digits of number and the sum of the digits.

  Write methods for calculating maximum value of array

Write down the methods for calculating maximum value, minimum value, and mean value of array. Use these methods to calculate and display minimum of array.

  Create a program that finds the solution

You will be required to create a program that finds the solution. To find the solution you will use the following algorithms: BFS, DFS and SA

  Which warning signs or red flags are of greater importance

Discuss which warning signs or red flags are of greater importance to 123's given their size and location. Provide rationale behind your ranking.

  Develop unix shell script to input number of hours

Develop a Unix shell script to input number of hours worked and pay rate and calculate the total pay, then the social security amount (assume 5%), then the net pay.

  Write code for invoking method named sendtwo

Write the code for invoking a method named sendTwo. There are two arguments for this method: a double and an int.

  Why are most programs still in cobol

Describe the approach and share your thoughts about this new approach to software development.

  User defined function to calculate average of three scores

A user defined function that will calculate and display the average of the 3 scores that remain after dropping the highest and lowest scores the performer received.

  Write a function that computes a taxi fare.

Write a function that computes a taxi fare. In some cities, taxi fares are calculated based on start and end zones plus a per-minute charge. In this city, there are three zones (1, 2, and 3) and a graduated scale for time. Thus, your function shou..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd