Write a function that accepts an array a as input


Write a function that accepts an array a as input, and searches the contents of the array for elements in three different ranges: [0 - 10), [10 - 50) and [50 - 100]. The function builds three arrays that contain the elements from the a array that are in found in each range. These 3 arrays are the output arguments. For an input of a=[2 5 36 70 40 62 8],your program should return these three arrays

x = [2 5 8]
y = [36 40]
z = [70 62]

If the input has no elements in a specific range, the corresponding output array should be empty. If any element in a is greater than 100 or is negative, the program should display the element and the index where it is found using fprintf , and then use the error function to terminate the program. Make sure your program prints all the invalid elementsin the format shown before terminating it using error.

 

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Write a function that accepts an array a as input
Reference No:- TGS0733817

Expected delivery within 24 Hours