What does the following program do?
```
// ex06_43.cpp
// What does this program do?
#include
using namespace std;
int mystery(int, int); // function prototype
int main() {
cout << "Enter two integers: ";
int x{0};
int y{0};
cin >> x >> y;
cout << "The result is " << mystery(x, y) << endl;
}
// Parameter b must be a positive integer to prevent infinite recursion
int mystery(int a, int b) {
if (1 == b) { // base case
return a;
}
else { // recursion step
return a + mystery(a, b - 1);
}
}
```
This program multiplies two integers recursively.
Enter two integers: 8 2
The result is 16
You might also like to view...
Explain how you can use a router to protect your computer from intrusions.
What will be an ideal response?
The meeting request window includes the To text box, where you enter email addresses for ____________________.
Fill in the blank(s) with the appropriate word(s).
_________ attributes include hardware details transparent to the programmer.
A. Interface B. Organizational C. Memory D. Architectural
The revision marks and annotations that appear in a document are referred to as ____________________.
Fill in the blank(s) with the appropriate word(s).