Evaluate the following:
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);




1) 10


2) 11


3) 1

Answer Posted / harish

11

Is This Answer Correct ?    10 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.

1584


One of the Institutes contains 5 student groups. Every group contains 4 students. Institute wants to store student group’s details in array. Group should contain group member’s details (name and registration number and age), project name, and mark of the group.

2145


What is type qualifiers?

647


What is methods in c?

631


What is static memory allocation?

597






What is a const pointer?

620


Is the exit() function same as the return statement? Explain.

650


What are structure members?

586


Write a program to know whether the input number is an armstrong number.

660


What is wrong with this initialization?

575


What are the two types of structure?

566


What is void main ()?

602


What is typeof in c?

596


Is malloc memset faster than calloc?

603


Explain the process of converting a Tree into a Binary Tree.

2089