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
the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?
we need to calculating INCOME TAX for the person. The INCOME TAX is as follows:- First $10000/- of income : 4% tax Next $10000/- of income : 8% tax Next $10000/- of income : 11.5% tax above $10, 00,00/- : 15% tax What is the Solution of this Question ?
List the difference between a While & Do While loops?
What is the purpose of sprintf() function?
Was 2000 a leap year?
Tell me about low level programming languages.
What is the concatenation operator?
How does #define work?
Explain how do you search data in a data file using random access method?
What does == mean in texting?
What language is windows 1.0 written?
What is atoi and atof in c?
Are the variables argc and argv are always local to main?
write a program which the o/p should b in such a way that s triangle if I/p is 3,a Square/rectangle if I/P=4,a pentagon if I/P=5 and so on...forget about the I/P which is less than 3
What is the best organizational structure?