Purchase Solution

Some Function Calls and their return values

Not what you're looking for?

Ask Custom Question

Trace the following program and give the return value for each function call:

int h (int b, int n)
{
if ( n = = 0)
return 1;
else
return(b * h(b, n-1));
}

(a). What are values for h(), assuming function calls as follows:
i. h(5,3)
ii. h(3,5)
iii. h(2,2)
(b). Describer the action of the function. What is the function in the <cmath> library that performs a similar calculation?

Purchase this Solution

Solution Summary

The solution tells in detail why and what the function is going to return.

Solution Preview

(a). What are values for h(), assuming function calls as follows:
i. h(5,3)
ii. h(3,5)
iii. h(2,2)

Answer ----
a. h(5,3) will return 125.

b. h(3,5) will return 243

c. h(2,2) will return 4.

(b). Describer the action of the ...

Purchase this Solution


Free BrainMass Quizzes
Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Basic Networking Questions

This quiz consists of some basic networking questions.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Javscript Basics

Quiz on basics of javascript programming language.