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
Write a program to print fibonacci series without using recursion?
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
Not all reserved words are written in lowercase. TRUE or FALSE?
what is the significance of static storage class specifier?
How can I swap two values without using a temporary?
Explain what math functions are available for integers? For floating point?
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
What do the functions atoi(), itoa() and gcvt() do?
Write a program to print factorial of given number using recursion?
What is f'n in math?
What is the purpose of main( ) in c language?
Explain how can I convert a string to a number?
Is array a primitive data type in c?
What is c language in simple words?
What are the properties of union in c?