How to convert hexadecimal to binary using c language ?
Output
Explanation:
Hexadecimal and Binary Values
| Hex | Decimal | Binary |
|---|---|---|
| 0 | 0 | 0000 |
| 1 | 1 | 0001 |
| 2 | 2 | 0010 |
| 3 | 3 | 0011 |
| 4 | 4 | 0100 |
| 5 | 5 | 0101 |
| 6 | 6 | 0110 |
| 7 | 7 | 0111 |
| 8 | 8 | 1000 |
| 9 | 9 | 1001 |
| A | 10 | 1010 |
| B | 11 | 1011 |
| C | 12 | 1100 |
| D | 13 | 1101 |
| E | 14 | 1110 |
| F | 15 | 1111 |
- We want to convert hexadecimal number AB1c to binary. For this we will replace each hexadecimal digit to binary values using the above table:
Hexadecimal Number: A B 1 c
Binary Values: (1010) (1011) (0001) (1100)
So (AB1c)16 = (1010101100011100)2