Write no recursive versions of the functions in Exercises 11-15.
Exercise 11
Determine what is calculated by the recursive functions
unsigned f(unsigned n)
{
if (n == 0) return 0;
// else
return n * f(n - 1);
}
Exercise 12
Determine what is calculated by the recursive functions
unsigned f(double x, unsigned n)
{
if (n == 0)
return 0;
Exercise 13
Determine what is calculated by the recursive functions
unsigned f(unsigned n)
{
if (n < 2)
return 0;
// else
return 1 + f(n / 2);
}
Exercise 14
Determine what is calculated by the recursive functions
unsigned f(int n)
{
if in < 0)
return f(-n);
if (n < 10)
return n;
// else
return f(n / 10);
}
Exercise 15
Determine what is calculated by the recursive functions
unsigned f(int n)
{
if (n < 0)
return f(-n);
if (n < 10)
return n;
// else
return f(n / 10);
}