Question: MIPS ASSEMBLY Write a function digit _ sum which accepts a single positive integer argument stored in $a 0 and computes the sum of the
MIPS ASSEMBLY
Write a function digitsum which accepts a single positive integer argument stored in $a and computes the sum of the digits of that argument recursively.
For example, the sum of the digits of
Your implementation must be recursive. An iterative solution will earn no credit for this problem.
Hint: Extracting the rightmost digit of an integer can be accomplished by dividing the integer by The quotient is the original integer with the rightmost digit removed, while the remainder is the removed digit.
Use ONLY the following commands:
addi
syscall
add
La
slti
beq
bne
jal
Lw
mflo
mfhi
div
jr
sw
j
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
