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...

fun(int x)
{
if(x > 0)
fun(x/2);
printf("%d", x);
}

above function is called as:
fun(10);

what will it print?



}

Answer Posted / shilpa m

Right answer is 0.
fun(int x)
{
if(x > 0)
fun(x/2);
printf("%d\n", x);
}
Here if fun(10)is called the sequence goes as fun(10)->fun
(5)->fun(2.5)->fun(1.25)->fun(0.625) after this itself
printf will be executed and 0 is printed.

please expalin how answer is 0 1 2 5 10 is right answer???

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program to generate random numbers in c?

1096


what do you mean by inline function in C?

1054


What are data types in c language?

1057


How do I round numbers?

1008


What is string in c language?

1153


How do you do dynamic memory allocation in C applications?

1087


Explain high-order and low-order bytes.

1096


What is the difference between mpi and openmp?

1290


What does 3 mean in texting?

1094


a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above

1391


What is console in c language?

1097


What is static memory allocation? Explain

1096


explain what is a newline escape sequence?

1089


Explain what is the benefit of using an enum rather than a #define constant?

1220


What is the meaning of ?

1040