9.9 User-Defined Functions: Even/odd values in an array
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.
7 years ago
5
Answer(2)![blurred-text]()
![]()
![blurred-text]()
![]()
Purchase the answer to view it

Purchase the answer to view it

NOT RATED
other Questions(10)
- Summary and Comments # 4
- ACC 349 Cost Accounting WEEK 3 DQ
- Question Translations and Reporting Issues Complete the following assignment. Submit your
- Project Planning – Developing the Project Plan and Determining Critical Path
- 4 page research paper in two hours if not dont bother to respond
- Economics Problem Set
- Rewording a paragraph
- Phase 2 Discussion Board – Part 1
- isis
- Delta Air .....with the link