Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Algorithms | Recursion | Question 3

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

What does the following function print for n = 25?




void fun(int n)
{
  if (n == 0)
    return;
  
  printf("%d", n%2);
  fun(n/2);
}  

(A) 11001
(B) 10011
(C) 11111
(D) 00000


Answer: (B)

Explanation: The function mainly prints binary representation in reverse order.

Quiz of this Question

My Personal Notes arrow_drop_up
Last Updated : 28 Jun, 2021
Like Article
Save Article
Similar Reads