hi everyone....i have to convert decimal numbers starting from 1 to 1024 into binary and i need access to all the bits. i have done an example which generates a random number and converts it into a 10-bit binary number. this one worked fine for me...
for(i=0;i<10;i++)
{
sec[i]= rand()%1023;
do
{
sym[i]= sec[i]%2;
b=sec[i]/2;
sec[i]=b;
b=b<<1;
}while(b=0);
printf(" %d", sym[i]);
}
here the output is sym where i represents the 10 bits.
but now i need to convert all the numbers starting from 1 to 1024 like...
1 - 0000000001
2 - 0000000010
3 - 0000000011
.
.
.
.
.
1024 - 1000000000