You must write and execute the code for this question in the MARS MIPS Emulator provided to you on
our myCourses webpage under Content/Resources. Your TA will only grade your work from the provided
Write the following program using MARS:
In the MIPS main () code area, prompt the user to input an integer number greater than or
Copyright By PowCoder代写 加微信 powcoder
equal to zero. Say to the user: “Please input an integer value greater than or equal to 0:
If the user inputs a value less than zero, then terminate the program with the message: “The
value you entered is less than zero. This program only works with values greater than or
equal to zero.”
3. If the user inputs a value greater than or equal to zero, then call a function called factorial
with the following C signature to calculate the factorial, recursively:
int factorial (int);
After the function factorial returns the answer to the main code area, from the main code
area, print the following messages:
“You input:” and the value they entered from the keyboard. New line.
“The factorial is:” and the value returned by the function factorial. New line.
Now, prompt the user to see if they would like to do this again. Tell the user to input a single
character ‘Y’ (capital letter Y) to do it again, all other characters will terminate the program.
If the user inputs ‘Y’ then go to step 1
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com