Convert Decimal To Binary

Write a program to convert decimal to binary

Binary is a base-2 number system. It uses only two digits: 0 and 1. The digits are called bits. A bit is the smallest unit of information in a computer. A bit can be either 0 or 1. A bit can be used to represent a single value, such as 0 or 1, or it can be used to represent a single state, such as on or off.

To convert a decimal number to binary, we can use the following algorithm:

  1. Divide the decimal number by 2.
  2. Write down the remainder.
  3. Divide the quotient by 2.
  4. Write down the remainder.
  5. Repeat steps 3 and 4 until the quotient is 0.
  6. The binary number is the sequence of remainders written in reverse order.
Input : 10 Output : 1010

Contributors

This program is made possible by the following contributors:

akshithagunupati
anandfresh
apurvagandhi
harshraj8843
Tushar12222
RiteshK-611
UrielOfir
hi-Kartik2004
Emilia-mazari
rafaover
joao-vitor-souza
Dheeraj0014
Simba-97
sanmay321

Heart with ribbonBecome a SponsorHeart with ribbon

Become a sponsor and help us maintain and improve this project. Every contribution counts. Thank you!