Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 / abdur rab

The answer is 11

( 7 - 1 ) + 3 -> 11 = (8 +3)

( 6 / 2 ) + 2 --> 8 = (6 +2)

( 3 - 1 ) + 3 ---> 6 = (3 +3)

( 2 / 2 ) + 2 ----> 3 = (1 +2)

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can a program be made to print the line number where an error occurs?

1096


Explain how can I remove the trailing spaces from a string?

1065


Describe the order of precedence with regards to operators in C.

1052


How many types of errors are there in c language? Explain

1001


What is substring in c?

1216


provide an example of the Group by clause, when would you use this clause

2204


what is the significance of static storage class specifier?

2276


HOW TO SOLVE A NUMERICAL OF LRU IN OS ??????

2709


What is the difference between single charater constant and string constant?

1107


What is file in c preprocessor?

1167


What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?

1147


Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix

2021


What is main () in c?

1084


Explain About fork()?

1127


What is the difference between far and near ?

1206