# Express the following # in BCD using six digits

1. Apr 12, 2015

### Duderonimous

1. The problem statement, all variables and given/known data
Hello,

Express the following number in BCD using 6 digits:

(99 7126)base10

2. Relevant equations
Algorithm for changing (99 7126)base10→(N1)base8→(N2)base2

BCD table:
Decimal BCD
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001

3. The attempt at a solution

(99 7126)base10→(N1)base8

997126/8=124640R6→d0
124640/8=15580R0→d1
15580/8=1947R4→d2
1947/8=243R3→d3
243/8=30R3→d4
30/8=3R6→d5
3/8=0R3→d6

N1=3633406

(3633406)base8→(N2)base2

N2= 011 110 011 011 100 000 110

In retorspect I realize that the above method is pointless.

I could directly convert the above number from decimal to BCD

but where does the "six-digits" factor. I would have much more then 6 digits when I convert that big number to BCD. Please help.

2. Apr 12, 2015

### Duderonimous

Does does a 4 bit code count as 1 digit?

(99 7126)base10 to
(1001 1001 0111 0001 0010 0110)BCD

Does the above answer count as 6 digits in BCD?

The next problem is

(43)base10 to BCD in 6 digits

(0000 0000 0000 0000 0100 0011)BCD

Last edited: Apr 12, 2015
3. Apr 12, 2015

### Staff: Mentor

I think you're on the wrong track here and are overthinking this. A decimal number can be converted to either unpacked BCD (each digit of the decimal number is stored in one byte) or packed BCD (each decimal digit stored in half a byte). You don't need to convert your decimal number into octal (base 8).

For example, in packed BCD, 9310 would be 1001 00112. In unpacked BCD 9310 would be 0000 1001 0000 00112.

4. Apr 12, 2015

### Duderonimous

Ok. Then I guess the method I learned in class about converting decimal numbers to BCD is the packed BCD representation. So then could you read my second post? I understand the algorithm and converting to base 8 was unecessary. Is my thinking correct in the second post?

5. Apr 12, 2015

### Staff: Mentor

Yes, six digits. Your (packed) BCD encoding is correct
Is it supposed to be packed BCD or unpacked BCD? If packed BCD, your answer looks good. If unpacked it would be 0000 0000 0000 0100 0000 0011 in binary.

6. Apr 12, 2015

### Staff: Mentor

Yes, what you have looks fine, now that you have clarified that you're doing packed BCD.

7. Apr 12, 2015

### Duderonimous

Thank you sir!

8. Apr 12, 2015

### Staff: Mentor

You're welcome!