GATE | Gate IT 2008 | Question 79

Consider the code fragment written in C below :

filter_none

edit
close

play_arrow

link
brightness_4
code

void f (int n)
  if (n <=1)  {
   printf ("%d", n);
  }
  else {
   f (n/2);
   printf ("%d", n%2);
  }
}

chevron_right


What does f(173) print?

(A) 010110101
(B) 010101101
(C) 10110101
(D) 10101101


Answer: (D)

Explanation: (173)2 = 10101101

Quiz of this Question



My Personal Notes arrow_drop_up


Article Tags :

1


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.