Question: 1 0 . ( 5 points ) Trace the execution of the following function by hand ( attach screenshots of your trace work ) .

10.(5 points) Trace the execution of the following function by hand (attach screenshots of your trace work). Then write a program that calls the function, passing it a number entered by the user. What does the function do?
```
void pb(int n)
{
if (n !=0){
pb(n /2);
putchar('0'+ n %2);
}
}
```
11.(2 points (bonus)) The Fibonacci numbers are \(0,1,1,2,3.5,8,13,\ldots \), where each number is the sum of the two preceding numbers. Write a program fragment that declares an array named fib_num bers of length 40 and fills the array with the first 40 Fibonacci numbers using iterative approach (loops). Hint: Fill in the first two numbers individually, then compute the rest.
i)(3 points (bonus)) Write a recursive function to solve the above problem.
1 0 . ( 5 points ) Trace the execution of the

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 Programming Questions!