Many a time, we are required to represent decimal numbers in a computer, and perform arithmetic on these numbers. For example, we may be required to total the marks a student has obtained in five different subjects, where obviously, the marks are awarded in decimal notation.
For this purpose, the BCD code is extensively used. In BCD notation, 4 bits are used to code a digit, and so two digits of information are stored in a Byte. For example, decimal 45 is represented in BCD as of 0100 0101. Codes 10 to 15 i.e. 1010, 1011, 1100, 1101, 1110, and 1111 are illegal in BCD notation. Similarly, decimal 2,048 is represented in BCD as 0010 0000 0100 1000. But the same decimal 2,048 is represented in binary as 0000 1000 0000 0000. As stated earlier, the value of a series of 0s and 1s depends on the interpretation.