Question: Here is some code that uses recursion. Assume that all values are integers and that the call to MyWriter is recursive. Procedure MyWriter(last, current: integer);

Here is some code that uses recursion. Assume that all values are integers and that the call to MyWriter is recursive.

Procedure MyWriter(last, current: integer);

Begin

If (current < 55) then

Begin

Temp := current + last;

MyWriter(current, temp);

Print(current);

End; {then clause}

End; {the procedure MyWriter

If I make an initial call to MyWriter of MyWriter(1, 2), what will be printed?

You may rewrite this in your favorite programming language to check your answer.

Assume that the line Print(current) prints out the value of current on a new line of output.

Output is: ____________, ____________, ____________, _____________, ____________, _____________, ____________

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!