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 / vinay
11 because it resrve every value in stack untill it become
1 then add all values.
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Which of these functions is safer to use : fgets(), gets()? Why?
Explain spaghetti programming?
What's the difference between constant char *p and char * constant p?
Differentiate call by value and call by reference?
What is difference between union and structure in c?
Why is void main used?
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
What are predefined functions in c?
How do you initialize pointer variables?
Write a C Program That Will Count The Number Of Even And Odd Integers In A Set using while loop
Explain what header files do I need in order to define the standard library functions I use?
What are the complete rules for header file searching?
What is maximum size of array in c?
What is difference between function overloading and operator overloading?
an expression contains relational operators, assignment operators, and arithmatic operstors. In the absence of parentheses, they will be evaluated in which of the following order a) assignment, relational, arithematic b) arithematic, relational, assignment c) relational, arithematic, assignment d) assignment, arithematic, relational