[EMAIL PROTECTED] wrote:
> iota from the C stlib.h

How is iota going to help him?  I'm guessing you had a typo for itoa,
but even that that is just converting his decimal number to a char*.

To convert decimal to binary you divide the number by two and print the
remainder. However, this will be in reverse order, which is why the
first response said to use a stack to reorder it.

int myInt = 21;

while (myInt > 0) {

     printf("%d", myInt % 2);
     myInt /= 2;
}

That will print the decimal value of 21 in binary (reverse order,)  so
instead of printing it push it onto a stack, then print out the stack
after you finish pushing the values.

Reply via email to