Evaluate:
int fn(int v)
{
if(v==1 || v==0)
return 1;
if(v%2==0)
return fn(v/2)+2;
else
return fn(v-1)+3;
}
for fn(7);
a) 10
b) 11
c) 1
Answer Posted / babita sharma
The answer would be
b.
11 Its teh recursive function.
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
Describe private, protected and public?
What problems might the following macro bring to the application?
Can char be a number c++?
Write a program for Divide a number with 2 and Print the output ( NOTE: Check for divide by zero error).
Is swift a good first language?
Is facebook written in c++?
How do you save a c++ program?
write a porgram in c++ that reads an integer and print the biggest digit in the number
What is runtime polymorphism in c++?
What does catch(…) mean?
what is COPY CONSTRUCTOR and what is it used for?
How many static variables are created if you put one static member into a template class definition?
What is the oldest programming language?
Why do we use using namespace std in c++?
What is an inline function in c++?