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
Is c++ vector dynamic?
What is meant by entry controlled loop?
What is c++ namespace?
What is a node class in c++?
What are references in c++?
Where can I run c++ program?
Search for: what is pair in c++?
What is type of 'this' pointer? Explain when it is get created?
What is microsoft c++ redistributable?
What do you mean by inheritance in c++? Explain its types.
What is a manipulative person?
Write a program using display() function which takes two arguments.
Which ide is best for c++?
Do you know what are pure virtual functions?
Explain public, protected, private in c++?