rlhintgrr bought 2 out of 2 answered question(s)
Recursive Function
8. Chapter 6 , “C Control Statements: Looping,” ( Listing 6.20 ) shows a power() function

that returned the result of raising a type double number to a positive integer value.

Improve the function so that it correctly handles negative powers. Also, build into the

function that 0 to any power other than 0 is 0 and that any number to the 0 power is 1.

(It should report that 0 to the 0 is undefined, then say it’s using a value of 1.) Use a loop.

Test the function in a program.

9. Redo Programming Exercise 8, but this time use a recursive function.

Leave a Reply

Your email address will not be published. Required fields are marked *

rlhintgrr bought 2 out of 2 answered question(s)
Recursive Function
8. Chapter 6 , “C Control Statements: Looping,” ( Listing 6.20 ) shows a power() function

that returned the result of raising a type double number to a positive integer value.

Improve the function so that it correctly handles negative powers. Also, build into the

function that 0 to any power other than 0 is 0 and that any number to the 0 power is 1.

(It should report that 0 to the 0 is undefined, then say it’s using a value of 1.) Use a loop.

Test the function in a program.

9. Redo Programming Exercise 8, but this time use a recursive function.

Leave a Reply

Your email address will not be published. Required fields are marked *