Yep, bitwise is the way to go...and here you go for 32-bit binary!!!
Code:
#include <stdio.h>
/*------------------------------------------------------------*/
/* Decimal to binary conversion */
void Decimal_2_Binary(unsigned int x, unsigned int c[32])
{
int bit;
for(bit = 0; bit < 32; bit++)
{
c[bit] = ((x >> bit) & 1);
}
}
/*------------------------------------------------------------*/
int main()
{
int bit;
unsigned int x;
unsigned int c[32];
printf("\nEnter an integer number smaller than 4,294,967,295: ");
scanf("%u", &x);
printf("\nConverting decimal to binary:\n");
Decimal_2_Binary(x, c);
printf(" Binary == ");
for(bit = 31; bit >= 0; bit--)
{
if(bit == 27 || bit == 23 || bit == 19 || bit == 15 || bit == 11 || bit == 7 || bit == 3)
{
printf(" ");
}
printf("%u", c[bit]);
}
printf("\n\n\n");
return 0;
}