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 / ashwin kumar
hi Gg
answer is 0 1 2 5 10
this not stack prlm dear
here printf is after the function call dear so it is
printing 0 1 2 5 10
if u wnt to see 10 5 2 1 0 as output plz keep printf
function before function call that is
fun(int x)
{
if(x > 0)
printf("%d\n", x);
fun(x/2);
}
but output will be 10 5 2 1 only on 0 is printed
this above new code will give segmentation error in netbeans
thank u dear
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are the 3 types of structures?
What are the functions to open and close the file in c language?
why do some people write if(0 == x) instead of if(x == 0)?
Why is main function so important?
Can you return null in c?
Write a program to reverse a given number in c?
What is keyword with example?
How can I insert or delete a line (or record) in the middle of a file?
Explain the difference between null pointer and void pointer.
about c language
What is c language & why it is used?
Write a C program to count the number of email on text
Explain pointers in c programming?
Write a program on swapping (100, 50)
What is n in c?