C program to convert decimal number into binary

c programming
c programming

In this post we will learn how to write a C Program to Convert Decimal Numbers to Binary Numbers.

Example 2

Convert the decimal number 35 to binary.


Write out the number at the right corner. Divide the number continuously by 2 and write the quotient and the remainder. The quotients move to the left, and the remainder is recorded under each quotient. Stop when the quotient is zero.

              0  <-  1 <-    2 <-    4 <-    8 <-    17 <-    35   Dec.

Binary            1        0        0         0          1           1  

Convert Decimal to Binary in C

Partner Sites