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 |
how to print the character with maximum occurence and print that number of occurence too in a string given ?
How can you find the day of the week given the date?
Can you please explain the difference between exit() and _exit() function?
int x=sizeof(!5.856); What will value of variable x?
Whats s or c mean?
Write a program that can show the multiplication table.
Explain what is the difference between the expression '++a' and 'a++'?
Write a C program to check a number even or odd, without using any relational, arithmetic operator and any loops.
marge linklist
c program to input values in a table(using 2D array) and print odd numbers from them
for(i=0;i=printf("Hello");i++); printf("Hello"); how many times how will be printed?????????
main() { int i = 1; int num[] = {1,2,3,4}; num[i] = i++; printf("%d", num[i]); } what will be the output? }
22 Answers NDS, TCS,