Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

if the user enters x=13 and y=49152, you should print: 1101.1100000000000000 ___

ID: 3655340 • Letter: I

Question

if the user enters x=13 and y=49152, you should print: 1101.1100000000000000 ____ _______________ x y As you can see, you should ignore the insignificant 0

Explanation / Answer

void printbitssimple(int n) { unsigned int i; i = 1>= 1; } } /* Print n as a binary number */ void printbits(int n) { unsigned int i, step; if (0 == n) { /* For simplicity's sake, I treat 0 as a special case*/ printf("0000"); return; } i = 1= 4; /* In groups of 4 */ while (step >= n) { i >>= 4; step >>= 4; } /* At this point, i is the smallest power of two larger or equal to n */ while (i > 0) { if (n & i) printf("1"); else printf("0"); i >>= 1; } } int main(int argc, char *argv[]) { int i; for (i = 0; i < 16; ++i) { printf("%d = ", i); printbitssimple(i); printf(" "); } return 0; }