%d - to print value in int format.
%o - to print value in octal format.
%x - to print value in hexadecimal format (letters will print in lowercase)
%lx - to print value in hex (long int) format (i.e any number > 0xFFFFFFFF (8Fs))
%X - to print value in hexadecimal format (letters will print in uppercase)
void print_octal(unsigned int n) {
for (int i = 30; i >=0 ; i-=3) {{
// 0x7 = 111
unsigned char x = ((n >> i) & 0x7);
printf("%o",x);
}
}
}