Question: Complete the function ReturnNumbers ( ) which takes one positive integer ( endValue ) as an input argument. The function should generate an array of

Complete the function ReturnNumbers() which takes one positive integer (endValue) as an input argument. The function should generate an array of integers from 1 to endValue, and from this array return:
oddNumbers: an array of odd numbers between 1 and endValue from smallest number to largest number
evenNumbers: an array of even numbers between 1 and endValue from smallest number to largest number
reverseNumbers: an array of numbers decreasing from endValue to 1
Note: While arrays are double, the entries will be integer numbers.
Restriction: Do not use loops, sort, or if else statements.
Hint: Use array indexing to select the required numbers to create odd, even and reverse output arrays.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!