In BCD, maximum number that can be represented is 9 i.e. 1001. [1010, 1011, 1100, 1101, 1110, 1111 are invalid in BCD representation].
For addition of BCD number, it may cause some problem when output is out of range.
Example:
Let take another example:
It is invalid in BCD because 1010 is 10.
Whenever we get any invalid pattern, we add 6 i.e. (0110) to correct it.
Note: If we get carry after adding 6 then take it as a number separately.
Whenever we are adding any BCD digits, 3 possible cases can appear:
Now the question is why we add 6 when an error occurred as an invalid number:
As we know only 0 to 9 is valid at BCD so, when we get an invalid range we add 6 to get a valid range again.
Example:
If we see the answer 0010 that is 2 which is valid in BCD, but it has a carry 1. It has an error.
[As we know if the addition of BCD is valid, but there is carry at the output, then still we add 6 to make the exact valid number.]
To correct it we have to add 6 i.e. (0110) to correct it.
Note: Again we got a carry but as we discussed earlier if we get carry after the addition of 6 it is not an error, take it as a separate number.
So,
We take another big example
So, we add 6 (i.e. 0110) in invalid answers.