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
Why is c++ still popular?
What is a driver program?
Will a C compiler always compile C++ code a) Yes b) No c) Only optimized compilers
What is recursion?
What is dev c++ used for?
Why do we use iterators?
Will this c++ program execute or not?
What is c++ programming language?
Why struct is used in c++?
What is while loops?
Why do we need function?
Write a C++ Program to check whether a number is prime number or not?
Can malloc be used in c++?
What is binary search in c++?
What does scope resolution operator do?