Prompt: Write a code in MARS MIPS that uses a stack to recursively compute the series from 1 to 10.
Greetings!!
Code:
main:
addi $a0,$0,1 #arguement set in
register a0
jal series #call function
addi $v0,$0,10
#termination parameter
syscall
series:
beq $a0,11,done #check upper
limit
addi $v0,$0,1 #parameter for display
number
syscall
#display
addi $a0,$a0,1 #increment
number
jal series #recursive call to the
function
done:
jr $ra
Output screenshot:
Hope this helps
Get Answers For Free
Most questions answered within 1 hours.