1.
Let’s start with a review question...
You just wrote the following program:
#include <stdio.h>
int myrecursion(int i, int j);
int main(void)
{
int a;
a = myrecursion(24,7);
printf("%d\n", a);
return(0);
}
int myrecursion(int i, int j)
{
if (i>j)
return myrecursion(i-j, j);
else
return(i);
}
What is the value of the variable a that is printed to the screen at the end of the program? Choose one: 3 / 7 / 10 / 17 / 24
How many times is the function
myrecursion()
called during execution of this program? Choose one: 1 time / 2 times / 3 times / 4 times / 5 times
Feel free to use the window below to experiment. You may want to add some
printf()
statements inside the recursive function to be able to track its behavior. Be sure to work the correct answer out "by hand" first before verifying your answer using the code window.
Enter your two answers, separated by a comma, i.e. 30, 8 times: