What does the following program do?

```
// What does this program do?
#include
using namespace std;

int mystery( int, int ); // function prototype

int main()
{
int x, y;

cout << "Enter two integers: ";
cin >> x >> y;
cout << "The result is " << mystery( x, y ) << endl;
} // end main

// Parameter b must be a positive integer to prevent infinite recursion
int mystery( int a, int b )
{
if ( b == 1 ) // base case
return a;
else // recursion step
return a + mystery( a, b - 1 );
} // end function mystery
```


This program multiplies two integers recursively.

Computer Science & Information Technology

You might also like to view...

Which of the following expressions is equivalent to the pseudocode shown here?

``` NOT eof(myStuff) ``` a. eof(myStuff) = True b. eof(myStuff) == True c. eof(myStuff) == False d. not eof == myStuff

Computer Science & Information Technology

A reference parameter:

a. Is an alias for its corresponding argument. b. Is declared by following the parameter’s type in the function prototype by an ampersand (&). c. Cannot be modified. d. Both (a) and (b).

Computer Science & Information Technology

Implementation of an enterprise resource planning (ERP) system ensures good work processes that are based on _____.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

You must lock guides before you can select them or delete them.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology