3.9k views

When two BCD numbers $0x 14$ and $0x 08$ are added what is the binary representation of the resultant number?

1. $0x 22$
2. $0x 1c$
3. $0x 16$
4. Results in overflow.
| 3.9k views

0x14=14

0x08=8

15 + 8 = 22. In BCD representation 4 bits represent a decimal digit from 0-9. So, here forst 4 bits represent 2, and next four bots represent 2 again.

0010 0010 = 0x22

Option A.
by Veteran (119k points)
selected by
0
how?
0
No - you converted numbers to decimal and added which is correct for normal decimal numbers written in binary. But BCD means numbers are already decimal but coded in binary. 0x14 = 14 because in BCD, we cannot have A-F and hence hex number is same as decimal.
0

corrected

but 2 question

is 0x14 and 0x08 are BCD number?

And 2nd question is it is asking for binary representation

0
ok done sir
+1
yes, because they are BCD. 0x means the binary numbers are converted to hex.
0
What is the correct Option A or B ?
+1
option A
0
How did you convert hex-decimal no into binary with unknown variable x.

in BCD it should be like this

0000  x  0001  0101

0000  x  0000  1000

--------------------------------------

0000  x  0001  1101

as far as i know about BCD addition it should be like this .But i m not quite sure how to write x.  Correct me if i m wrong.
+3
@shekhar - x is not unknown- 0x means hex coded - 4 bits of binary being represented using a hex digit to make it more readable.

Now, in your answer you have to add '6' as the result is over 9 for the least significant digit addition as per rule of binary addition for BCD.

And yes we can simply do decimal addition because that is what is asked in question :)
0

Thanks .   I have to learn a lot.

But why he has written that addition  of these 2 no's in binary is 22

in binary a no has base 2. how come a no 22 be in binary .it should be represented  in  either 0 or 1

0
@Arjun sir , it is a  packed BCD concept rt?

0
not 15+8 it is 14+8 =22

typo in the explanation

as far I know we need to add a correction of 6 whenever the sum in BCD addition is greater than 9.

0x14  -->      0001   0100

0x08   -->     0000   1000

---------------------------------

1100   (sum of last 4 bits)

------------------------------------------

0010     0010      --------------> 0x22

--------------------------------------------------

by (101 points)
0

In the below ans

1100   (sum of last 4 bits)

------------------------------------------

0010     0010      --------------> 0x22

how did two 2 s come ?? the one highlighted in yellow come ??

0
got it the overflow 1 is added to 0001 (previously existing ) Thanks !

0means the numbers are given in hexadecimal format.

Now 0x14 means it's simple 14 and not E iin hexadecimal.

so writing BCD of 14 = 0001 0100

BCD of 8 =                 0000 1000

Adding above two gives 0001 1100

Now since there is an overflow in the LSB (8+4) part of the numbers, add 0110( decimal equivalent 6) to this as per bcd rules of addition.

0001 1100

0000 0110

which is 22 in BCD.

and so in hexadecimal each digit of BCD can be represented directly.

by Boss (29.2k points)

I think answer should be c...

A=0x14

b=0x08

according to BCD packed number  as per this tutorial

by (211 points)

0x14 = 0001 0100 (These numbers are not simple binary, but BCD, ie, they represent decimal values) = 14

0x08 = 0000 1000 = 08.

Add 14 and 8 = 22. 22 in BCD is 0010 0010 (each digit is encoded to equivalent binary)

0010 0010 = 0x22

Option A

by Loyal (7k points)
0
If "0x" is used to represent hexadecimal format number then what is used for octal representation.
0

For octal, just 0 is prefixed to the number.

The compiler sees 123 as 123 in decimal

But it sees 0123 as 123 in octal.