{"id":18041,"date":"2021-11-23T18:39:39","date_gmt":"2021-11-23T18:39:39","guid":{"rendered":"https:\/\/assignmenttutors.net\/blog\/9-9-user-defined-functions-even-odd-values-in-an-array\/"},"modified":"2021-11-23T18:39:39","modified_gmt":"2021-11-23T18:39:39","slug":"9-9-user-defined-functions-even-odd-values-in-an-array","status":"publish","type":"post","link":"https:\/\/assignmenttutors.net\/blog\/9-9-user-defined-functions-even-odd-values-in-an-array\/","title":{"rendered":"9.9 user-defined functions: even\/odd values in an array"},"content":{"rendered":"<div>\n<p>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.<\/p>\n<p>Ex: If the input is 2 4 6 8 10, the output is:<\/p>\n<pre><code>all even<\/code><\/pre>\n<p>Ex: If the input is 1 3 5 7 9, the output is:<\/p>\n<pre><code>all odd<\/code><\/pre>\n<p>Ex: If the input is 1 2 3 4 5, the output is:<\/p>\n<pre><code>not all even or all odd<\/code><\/pre>\n<p>Your program should define and use two functions:\u00a0<\/p>\n<pre><code>Function countEvensInArray(integer array(?) userVals) returns integer numEven<\/code><\/pre>\n<pre><code>Function countOddsInArray(integer array(?) userVals) returns integer numOdd<\/code><\/pre>\n<p>countEvensInArray should return 5 if all integers in the array are even. countOddsInArray should return 5 if all integers in the array are odd.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[],"class_list":["post-18041","post","type-post","status-publish","format-standard","hentry","category-homework-help"],"_links":{"self":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts\/18041","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/comments?post=18041"}],"version-history":[{"count":0,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts\/18041\/revisions"}],"wp:attachment":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/media?parent=18041"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/categories?post=18041"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/tags?post=18041"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}