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
Define VARIABLE?
Are the variables argc and argv are local to main?
What is dynamic dispatch in c++?
Explain how can you determine the size of an allocated portion of memory?
What is #line?
What are the different types of errors?
What is the use of define in c?
A collection of functions,calls,subroutines or other data a) library b) header files c) set of files d) textfiles
Do character constants represent numerical values?
I need testPalindrome and removeSpace
#include
Explain function?
What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?
Can you return null in c?
How many header files are in c?
What is a list in c?