Jun 132012

What will be the output of the below function if n is positive ?

    void myFun(unsigned int n)
        if(n != 0)
            printf("%d", n % 2);


The function prints the value of n in binary notation. For example: If n = 25 then the output will be 1 1 0 0 1.

Actually printing the remainders in reverse order (Head Recursion).

  One Response to “Output of a recursive function”

Comments (1)
  1. quite nice post, i certainly adore this web page, keep on it

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>