Internally in a computer, with few exceptions, all computation is done using binary numbers. Output, however, often
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 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 Answer:
Logic And Computer Design Fundamentals
ISBN: 9780133760637
5th Edition
Authors: M. Morris Mano, Charles Kime, Tom Martin