Converting a decimal number to a binary number is easy. You just have to divide the decimal number by 2. If the division yields an integer, note 0, otherwise 1.

Now take the integer part of the division and divide it again by 2. Here, too, the value 0 or 1 is determined analogously.

This is done until the result of the division is 0.

Here is an example:

Advertisement

Number | :2 | Integer | Rest |
---|---|---|---|

123 | :2 | 61 | 1 |

61 | :2 | 30 | 1 |

30 | :2 | 15 | 0 |

15 | :2 | 7 | 1 |

7 | :2 | 3 | 1 |

3 | :2 | 1 | 1 |

1 | :2 | 0 | 1 |

Then you take the remaining numbers from bottom to top. The Result is **1111011**.

(Visited 89 times, 1 visits today)