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

GATE · 2008 · IT

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 271 students.

Sign up free to check your answer

Sign up free

Explore the full course: Isro

Loading lesson…