#include<stdio.h>
void printBinary( int x)
{
int i;
int j =0;
int a[32]={0};
// if x is an integer
if(x>0)
{
while(x)
{
a[j++] = x % 2;
x = x / 2 ;
}
}
// else if x is a negative integer
else
{
unsigned int X = (unsigned int)x;
while(X)
{
a[j++] = X % 2;
X /= 2 ;
}
}
for(i=31; i>=0; i--)
{
printf("%d", a[i]);
if(i % 8 == 0 && i != 0)
printf(",");
}
puts("");
}
void main()
{
printBinary(-15);
}