Consider the following recursive C function that takes two arguments unsigned…

ISRO Scientist/Engineer SC · 2020 · Computer ScienceGATE · 2011 · CS · Computer Science & IT

Consider the following recursive C function that takes two arguments

unsigned int rer (unsigned int n, unsigned int r) {
  if (n > 0) return (n% r + rer(n/r, r));
  else return 0;
 } 

What is the return value of the function rer when it is called as rer (513, 2) ?

  1. A.

    9

  2. B.

    8

  3. C.

    5

  4. D.

    2

Attempted by 568 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…