Question: MIPS assembly recursive function help needed psuedocode of what it should resemble: recurse(n) { print 4*n spaces; print recursing; print n if n == 0
MIPS assembly recursive function help needed
psuedocode of what it should resemble:
recurse(n)
{
print 4*n spaces; print recursing; print n
if n == 0
{ print space; print returning 1
return 1;
else
{
result = recurse(n-1);
result = n * result + 1;
print 1 space; print returning; print result;
return result;
}

I have most of it down I think I am just unsure how to do the recursive calls in MIPS
Console Please enter a decimal integer between 1 and 12 (or 0 to stop): 4 recursing 4 recursing 3 recursing 2 recursing 1 recursing 0 returning 1 returning 2 returning 5 returning 1 6 returning 65 Please enter a decimal integer between 1 and 12 (or 0 to stop): 13 Please enter a decimal integer between 1 and 12 (or 0 to stop): 6 recursing recursing recursing 4 recursing 3 recursing 2 recursing 1 recursing 0 returning 1 returning 2 returning 5 returning 16 returning 65 returning 326 returning 1957 Please enter a decimal integer between 1 and 12 (or 0 to stop): 0 Terminating!| Console Please enter a decimal integer between 1 and 12 (or 0 to stop): 4 recursing 4 recursing 3 recursing 2 recursing 1 recursing 0 returning 1 returning 2 returning 5 returning 1 6 returning 65 Please enter a decimal integer between 1 and 12 (or 0 to stop): 13 Please enter a decimal integer between 1 and 12 (or 0 to stop): 6 recursing recursing recursing 4 recursing 3 recursing 2 recursing 1 recursing 0 returning 1 returning 2 returning 5 returning 16 returning 65 returning 326 returning 1957 Please enter a decimal integer between 1 and 12 (or 0 to stop): 0 Terminating!|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
