Solved

Consider the Following Definition of the Recursive Function Mystery \quad Return 0;
Else If (First == Last)

Question 11

Multiple Choice

Consider the following definition of the recursive function mystery. int mystery(int first,int last)
{
if (first > last)
\quad Return 0;
else if (first == last)
\quad Return first;
else
\quad return first + mystery(first + 1,last - 1) ;
}
What is the output of the following statement?
cout << mystery(6,10) << endl;


A) 13
B) 21
C) 40
D) 42

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions