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
Get step-by-step solutions from verified subject matter experts
