Write a MIPS procedure that takes as its three parameters the starting address of an integer array, and two positive integers low and high, and returns the sum of the low’th through the high’th array elements. For example, for the array 3, 8, -1, 5, 4, 3, 9 and low and high values of 2 and 4, the return value should be 12 (since the sum of the 2nd through the 4th array elements is 8 + -1 + 5 = 12). Also, write a main program to test your procedure. Your main program should input the number of integers n in the array from the user (you may assume that n is at most 25), input the n integers, and then input the integers low and high. Your main program should then invoke your procedure, output the return value, and terminate. Your code must use the “standard” conventions for passing parameters and returning results.
Write a MIPS procedure that takes as its three parameters the starting address of an integer array, and two positive integers low and high, and returns the sum of the low’th through the high’th array elements. For example, for the array 3, 8, -1, 5, 4, 3, 9 and low and high values of 2 and 4, the return value should be 12 (since the sum of the 2nd through the 4th array elements is 8 + -1 + 5 = 12). Also, write a main program to test your procedure. Your main program should input the number of integers n in the array from the user (you may assume that n is at most 25), input the n integers, and then input the integers low and high. Your main program should then invoke your procedure, output the return value, and terminate. Your code must use the “standard” conventions for passing parameters and returning results.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images