Question: Internally in a computer, with few exceptions, all computation is done using binary numbers. Output, however, often uses ASCII, which is formed by appending 011
Internally in a computer, with few exceptions, all computation is done using binary numbers. Output, however, often uses ASCII, which is formed by appending 011 to the left of a BCD code. Thus, an algorithm that directly converts a binary integer to a BCD integer is very useful. Here is one such algorithm:
1. Draw lines to bound the expected BCD decades to the left of the binary number.
2. Move the binary number one bit to the left.
3. Add 0011 to each BCD decade containing a binary value > 0100.
4. Repeat steps 2 and 3 until the last bit in the binary number has been moved into the least signiicant BCD decade position.
5. Read the BCD result.
(a) Execute the algorithm for the binary number 1111000.
(b) Execute the algorithm for the binary number 01110010111.
Step by Step Solution
3.40 Rating (156 Votes )
There are 3 Steps involved in it
a 1st Move L 102 101 100 1111000 1 111000 11 11000 2nd Move L 3rd Move L Add 3 4th Move L Add ... View full answer
Get step-by-step solutions from verified subject matter experts
