Write a MARIE program that will sum the absolute values of the elements in an array and find the largest and smallest element in an array. The program needs to have two functions. The first should be...


Write a MARIE program that will sum the absolute values of the elements in an array and find the largest and smallest element in an array.


The program needs to have two functions. The first should be named sumArray and the second should be named searchArray. At entry to each function, the global variable array should contain the address of the array to process and the variable arraySize should contain the number of elements in the array. The result of sumArray should be stored in the variable sumResult. The result of searchArray should be stored in the variable smallestResult and largestResult.


Obviously, the function sumArray should sum the absolute values of all of the elements in the array and store the result in sumResult and the function searchArray should search the array for the largest and smallest element and store the result in smallestResult and largestResult.


Define two arrays. The first array should contain the numbers 5, 36, 12, -6, 93, -100 and the second array should contain the numbers -1, 13, 513, 64, -23.


The main program needs to call sumArray and searchArray twice. The first time setting array and arraySize to the first array and the second time setting array and arraySize to the second array. After calling each function, the main program should display the value of sumResult, smallestResult and largestResult via the OUTPUT instruction.

Apr 23, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here