Fill This Form To Receive Instant Help
Homework answers / question archive / CSCI 3301–MIPS Programming Using SPIM Programming Assignment Part 1 [50 points]: The factorial function is mathematically defined as: ? ?! = ∏ ? ?=1 For example, factorial of 6, that is 6! = 720, which is computer as: 6 ? 5 ? 4 ? 3 ? 2 ? 1
CSCI 3301–MIPS Programming Using SPIM
Programming Assignment
Part 1 [50 points]:
The factorial function is mathematically defined as:
?
?! = ∏ ?
?=1
For example, factorial of 6, that is 6! = 720, which is computer as: 6 ? 5 ? 4 ? 3 ? 2 ? 1.
Write a recursive MIPS assembly program using SPIM simulator (such as QtSpim), where for a given number (n) as an input (taken from the console), the program will recursively compute and return the corresponding factorial number. For retuning the result, use the standard console (screen) and print the output. You program must be able to take positive as well as negative integer numbers as input and must be able to respond appropriately.
Edge cases:
Page 1
Part 2 [50 points]:
Develop a MIPS program, “SORT”, to sort a set of given integers (note: both positive and negative integers are allowed) by the user. Note that, you can use any sorting algorithm you want including the Bumble sort which we covered in the class.
First, your program will ask the user, how many numbers the user wants to enter, and then ask the user to provide those numbers. Your program will read in those numbers and will place those numbers in an array.
Sort the array elements in ascending order.
Now, print the set of numbers that the user entered saying, “You have entered: …”. Then, print the sorted list saying, “Here is the sorted list in ascending order: …”.
Edge cases:
Already member? Sign In