Search This Blog

C Program to Convert Between Hexadecimal, Octal, Binary and Decimal Numbers

This program deals with four number systems. They are:

  • Decimal (base 10)
  • Binary (base 2)
  • Octal (base 8)
  • Hexadecimal (base 16)
Here i post a  program for following operations:
  • Decimal to binary conversion
  • Decimal to Octal conversion
  • Decimal to Hexadecimal conversion
  • Binary to Decimal conversion
  • Binary to Octal conversion
  • Binary to Hexadecimal conversion
  • Octal to Decimal conversion
  • Octal to Binary conversion
  • Octal to Hexadecimal conversion
  • Hexadecimal to Decimal conversion
  • Hexadecimal to Binary conversion
  • Hexadecimal to Octal conversion
The following program lets you convert between the four number systems; decimal, binary, octal and hexadecimal number systems.

Octal to Decimal Converter Program - Program to Convert from Octal to Decimal

This is a c program to convert any Octal number to decimal number system. Octal number system represents numbers using digits 0 to 7. The decimal number system is the commonly used number system which uses digits 0 to 9. The following program performs conversion from octal to decimal.

Program to Convert Hexadecimal to Decimal - Hexadecimal Conversion Program

Hexadecimal number system is base 16 number system in which the digits used are 0 to 9 and A to F. Here is a c program to convert hexadecimal number to decimal number system.

Program to Convert Binary to Decimal - Binary to Decimal Converter Program

This is a c program to convert a binary number to decimal number. The input (binary number) should contain only zeros and ones. Binary number system represents numbers using only two digits; 0 and 1. The following is a binary to decimal converter program in C.

Program to Convert Decimal to Binary - Binary Converter Program

This is a C program to convert decimal numbers to Binary numbers. Binary number system is the base 2 number system. The digits used in this number system are 0 and 1 only. The program is as follows:

Program to Convert Decimal to Octal Number - Decimal to Octal converter

This is a program to convert a number in decimal (base 10) number system to octal number system. In octal number system, numbers are represented with base 8. That is, the digits are 0 to 7. The following program converts decimal numbers to octal.

Program to Convert Decimal Number to Hexadecimal Number

This program is to convert a number in decimal number system (base 10) to a hexadecimal number (base 16). I have wrote a function reversestring to reverse a string. You may use strrev function instead if available. The program is as follows: