fun(int x)
{
if(x > 0)
fun(x/2);
printf("%d", x);
}
above function is called as:
fun(10);
what will it print?
}
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / enigma
Strictly speaking the answer is undefined until someone forces the output text from the console buffer to the screen.
Otherwise it would normally print 012510
Debug it inside MSVC and witness no output. In reality though most implementations will do a final flush to screen....
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / mortal
it will print "0" i.e zero since compiler wont get to the
print statement until the value is zero.
Is This Answer Correct ? | 2 Yes | 5 No |
1 1 2 1 2 3 1 2 3 4 1 2 3 1 2 1 generate this output using for loop
main() { printf("hello"); fork(); }
Write a C program that reads a series of strings and prints only those ending in "ed"
write a c program that prints all multiples of 3between 1 and 50.
Does c have enums?
What is the use of sizeof () in c?
What are the commands should be given before weiting C Program i.e, Cd.. like
4 Answers IBM, Infonet, Satyam, Tech Mahindra,
Write a program to enter the name and age. If age>28 then find salary categories. if age<28 then find that you are gaduate or not.
Explain what are reserved words?
What is the difference between if else and switchstatement
If you know then define #pragma?
What is an example of structure?