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


Please Help Members By Posting Answers For Below Questions

Write a program to print fibonacci series without using recursion?

594


Draw a flowchart to produce a printed list of all the students over the age of 20 in a class .The input records contains the name and age of students. Assume a sentinel value of 99 for the age field of the trailer record

4733


Not all reserved words are written in lowercase. TRUE or FALSE?

712


what is the significance of static storage class specifier?

1650


How can I swap two values without using a temporary?

602






Explain what math functions are available for integers? For floating point?

600


i want to switch my career from quailty assurance engineering to development kindly guide me from which programming language its better for me to start plz refer some courses or certifications too i have an experience of 1.5 yrs in QA field.Kindly guide me

1470


What do the functions atoi(), itoa() and gcvt() do?

715


Write a program to print factorial of given number using recursion?

592


What is f'n in math?

607


What is the purpose of main( ) in c language?

606


Explain how can I convert a string to a number?

632


Is array a primitive data type in c?

566


What is c language in simple words?

579


What are the properties of union in c?

577