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
How can I invoke another program or command and trap its output?
What is the difference between text and binary modes?
What does %c do in c?
What is a spanning Tree?
What is 1f in c?
Explain high-order bytes.
What does the error 'Null Pointer Assignment' mean and what causes this error?
write a program to copy the string using switch case?
Describe explain how arrays can be passed to a user defined function
Explain the bubble sort algorithm.
What is #define?
What is break in c?
How many identifiers are there in c?
Write a program to print “hello world” without using semicolon?
What is string function in c?