Implement these two procedures: - Multiply (procedure name multiply): multiply(n
ID: 3610198 • Letter: I
Question
Implement these two procedures:- Multiply (procedure name multiply):
multiply(n,m)=0, if either mor n is 0
multiply(n,m)=multiply(n,m-1)+n, otherwise
- Exponent (procedure name exponent):
exponent(n,m)=n^m (using aloop) or multiply(n,exponent(n,m-1)) (call multiplyprocedure)
in MIPS assembly not using the predefined multiply command in MIPS(only for exponent procedure). Don't worry aboutoverflow.
The output should look like this:
Press 1 for multiply operation
Press 3 for exponent operation
Press 4 to quit
Which operation? 1
Enter n: 2
Enter m: 5
The answer is 10
Thanks!
Explanation / Answer
x.