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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started