recategorized by
483 views
2 votes
2 votes

Consider the following C program.

#include <stdio.h>
    main() {
    int arr[] = {1, 1, 2, 4, 8, 16, 32, 64};
    int i, j, val, t = 16;
    unsigned char c;
    for (i = 0; i < 256; i++) {
        c = i;
        val = 0;
        for (j = 0; j < 8; j++)
            val = val + ((c >> j) & 0x1)*arr[j];
            if (val == t)
                printf("%d\n", i);
    }
}

What will be the output of the program if t = 130 (instead of 16)? Justify.

recategorized by

1 Answer

Related questions