Consider the code fragment below : #include <stdio.h> void f(int n) { if (n <=…

PYQ GATE 2008

Consider the code fragment below : 

#include <stdio.h>

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

What does f(173) print?

  1. A.

    010110101

  2. B.

    010101101

  3. C.

    10110101

  4. D.

    10101101

Attempted by 270 students.

Sign up free to check your answer

Sign up free

Explore the full course: Zero To Hero

Loading lesson…