# Hexadecimal To Binary Conversion C Program

By | June 11, 2016

## C Program For Hexadecimal To Binary Conversion

Let us learn how to write a code for hexadecimal to binary conversion in C programming language. This C program to convert hexadecimal number into binary value makes use of a switch case. The switch method includes a case for every digit of the hexadecimal number system.

The hexadecimal number system is also known as Hex. The base of a hexadecimal number is 16. Therefore, it includes a total of 16 symbols including numbers and characters.

The symbols acceptable in a hexadecimal number system are as follows:

A, B, C, D, E, F, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0

where, A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.

#### Example

(F12E)16 = (1111 0001 0010 1110)2

Every character or number in a hexadecimal number system has a particular value in binary number system. All you need is to match that value with the binary number format.

#### Output

If you have any doubt or compilation error in this C code for hexadecimal to binary conversion, let us know about it in the comment section.

## 2 thoughts on “Hexadecimal To Binary Conversion C Program”

1. Raju Rastogi

Such a simple Hex to Decimal Number conversion c program. Switch cases makes it so easy to solve it. Thanks.

1. Tushar Soni Post author

You’re welcome. Actually Hexadecimal to Binary conversion programs are quite simple to understand if done using switch cases.