C Program Convert Decimal to Binary

Prev Tutorial Next Tutorial

Convert Decimal to Binary Programs in C

Decimal system is the most widely used number system. But computer only understands binary. Binary, octal and hexadecimal number systems are closely related and we may require to convert decimal into these systems. Decimal system is base 10 (ten symbols, 0-9, are used to represent a number) and similarly, binary is base 2, octal is base 8 and hexadecimal is base 16.

Concept to Convert Decimal to Binary

To convert integer to binary, start with the integer in question and divide it by 2 keeping notice of the quotient and the remainder. Continue dividing the quotient by 2 until you get a quotient of zero. Then just write out the remainders in the reverse order.

Example of Convert Decimal to Binary

In below example we convert 13 into Binary

  • 13:2=6+1
  • 6:2=3+0
  • 3:2=1+1
  • 1:2=0+1

Now, we simply need to write out the remainder in the reverse order-1101. So, 13 in decimal system is represented as 1101 in binary.

Decimal to Binary Conversion in C


void main()
int no,rem[20],i=0,j;
printf("Please Enter any Decimal Number: ");
printf("Binary number is: ");
printf(" %d",rem[j]);


Please Enter any Decimal Number: 15
Binary number is: 1111

Prev Tutorial Next Tutorial

Download Projects

Google Adsense Advertisements
Free Classified Site – Bedpage

Yahoo Advertisements