Question: Create a MIPS asm program using MARS 4.5 that reads in two unsigned integers from the keyboard (x and y), and computes x mod y.

Create a MIPS asm program using MARS 4.5 that reads in two unsigned integers from the keyboard (x and y), and computes x mod y. You may assume that y is NOT zero. The result should be outputted to the screen. Your solution should utilize a recursive function and no division. \

Here is one solution in C++:

int modulus(int val, int divisor){

if(val < divisor)

return val;

else

return modulus(val - divisor, divisor);

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!