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 / mahesh patil
Only answer 1
answer 4
answer 7 are correct others are wrong..
If you are confident on your answers please check once then
write a post.
Correct Answer: 0 1 2 5 10
This will print in reverse order because, This is a
recursive call, Every time a function is called the values
are stored in stack/stack is created. when x value reaches
0 then it will return. So stack is LIFO order, So it will
print the values in reverse order.
| Is This Answer Correct ? | 9 Yes | 0 No |
Post New Answer View All Answers
Is c is a high level language?
Under what circumstances does a name clash occur?
How can I do serial ("comm") port I/O?
How can I use a preprocessorif expression to ?
What is "Duff's Device"?
Explain what does the function toupper() do?
Should I use symbolic names like true and false for boolean constants, or plain 1 and 0?
What is the use of sizeof () in c?
When the macros gets expanded?
Program will then find the largest of three numbers using nested if-else statements. User is prompted to enter three numbers. Program will find the largest number and display it on the screen. All three numbers entered by the user are also displayed. If user enters 21, 33, and 5, the output should be as follows: You entered: 21, 33 and 5. The largest number is 33.
What is #include called?
What are the types of c language?
Write a program of advanced Fibonacci series.
pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)
Explain union.