The Threat Lab team analyzes data from WatchGuard’s Firebox Feed, internal and partner threat intelligence, and a research honeynet, to provide insightful analysis about the top threats on the Internet. Check out our Q1 2018 report for smart, practical security advice today!

1. all numbers are stored in binary format.

2. octal and hexadecimal are powers of 2.

3. to get bit by bit of a number, u can use the 'right-shift'( >> ) operation in C.

4. to divide a number by 2^n, right shift the number by n bits.

so here is the procedure to get the binary/octal/hexadecimal representation of the number.

keep this string of bits/octets/hex-bits

char *nbits="0123456789abcdef";

1. to get the binary representation of the number..

right-shift bit by bit and keep storing/printing the bits one by one.

(for each shifted bit print---> nbits[value_of_shifted_bit

2. to get the octal representation of the number..

right-shift the number by 3-bits at a time, and each time checking the number in the thus got 3 shifted bits, and print the appropriate octet.

(for each shifted bit print---> nbits[value_of_shifted_bit

3. for hexadecimal, shift the bits 4 at a time

(for each shifted bit print---> nbits[value_of_shifted_bit

the number that u'll print this way will be in the right-to-left direction ( reversed from normal left-to-right)

try implementing code on this and we will help you out to make it work.

akshay