**News Alert:**Experts Exchange Confirmed as Safe in Cloudbleed Leak Read More

Solved

Posted on 2004-09-24

Does anyone know an algorithm to convert a decimal STRING, (not a 'number') to it's binary equivalent?

i.e.: "4654879791" -> "100010101011100111101010000101111"

i.e.: "4654879791" -> "1000101010111001111010100

2 Comments

the only way I can see is to add up the powers of ten til you get the whole number, then convert to binary:

Tot = 0;

for all digits: Tot = Tot * 10 + this_digit;

while Tot isnt Zero: if Tot is odd, print "1" else print "0"; divide Tot by two;

{ Then flip the paper over so you see the digits in reverse order! }

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Title | # Comments | Views | Activity |
---|---|---|---|

Proportion | 4 | 49 | |

Math home work questions | 5 | 97 | |

Geomentry-Fundamental concepts | 6 | 66 | |

110V Lasko bladeless fan blows with a burning smell | 5 | 77 |

Join the community of 500,000 technology professionals and ask your questions.