219k views
2 votes
Write the steps to convert a zoned decimal number to a packed decimal number.

User Jhaagsma
by
8.3k points

1 Answer

3 votes

Final answer:

Steps to convert a zoned decimal number to a packed decimal number.

Step-by-step explanation:

Steps to convert a zoned decimal number to a packed decimal number:

  1. Each digit in the zoned decimal number represents a 4-bit binary number.
  2. Subtract 3 from the left-most digit of the zoned decimal number to get the corresponding binary representation.
  3. Concatenate the binary representation of each digit to form the packed decimal number.

For example, let's convert the zoned decimal number +345 to a packed decimal number:

  1. The binary representation of the positive sign (+) is 1100.
  2. The binary representation of 3 (the first digit) is 0011.
  3. The binary representation of 4 (the second digit) is 0100.
  4. The binary representation of 5 (the third digit) is 0101.

The packed decimal number is +001101000101.

User Dnephin
by
8.1k points