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

What is a union?

613


Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result

1472


Why void main is used in c?

564


What is an arrays?

658


largest Of three Number using without if condition?

1010






What is c variable?

556


What is the difference between break and continue?

609


Can you add pointers together? Why would you?

651


What does %c mean in c?

656


What is realloc in c?

581


What are the 4 types of unions?

613


How to find a missed value, if you want to store 100 values in a 99 sized array?

821


What does the && operator do in a program code?

700


A SIMPLE PROGRAM OF GRAPHICS AND THEIR OUTPUT I WANT SEE WAHAT OUTOUT OF GRAPHICS PROGRAM

1701


Can we access array using pointer in c language?

650