Question: Given the following function definition: int xyz ( int number ) { int answer; if ( number > 1 5 ) answer = number; else

Given the following function definition:
int xyz(int number)
{
int answer;
if (number >15)
answer= number;
else if (number %5==0)
answer= xyz(number *2)-1;
else
answer= xyz(number +1)-2;
return result;
}
Questions:
When the following call is made:
cout << xyz(2)<< endl;
The output displayed is
12
How many calls to xyz() were made

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!