You dont have a option like %x for binary numbers so you need to write a function to print or you can create a string and just print that. Try something like
void bin(unsigned n)
{
unsigned i;
for (i = 1 << 31; i > 0; i = i / 2)
(n & i)? printf("1"): printf("0");
}