# Post Office Zip Code bars

Problem: For faster sorting of letters, the United States Postal Service encourages companies that send large volumes of mail to use a bar code denoting the ZIP code. The encoding scheme for a five-digit ZIP code is show in Table 1. There are full-height frame bars on each side. The fie encoded digits are followed by a correction digit, which is coputed as follows: Add up all digits, and choose the correction digit to make the sum a multiple of 10. For example, the zip code 95014 has sum of digits 19, so the correction digit is 1 to make the sum equal to 20.

Each digit of the zip code, and the correction digit, is encoded according to Table 1, where 0 denotes a half bar and 1 a full bar. Note that they represent all combinations of two full and three half bars. The digit can be easily computed from the bar code. For example, 0110 is 0 x 7 + 1 x 4 + 1 x 2 + 0 x 1 + 0 x 0 = 6. The only exception is 0, which would yield 11 according weight formula.

Table 1:
1 00011
2 00101
3 00110
4 01001
5 01010
6 01100
7 10001
8 10010
9 10100
0 11000

Write a program that asks the user for a zip code and prints the bar cod. Use : for half bars, | for full bars. For example, 95014 becomes

||:|:::|:|:||::::::||:|::|:::|||

Where the first and last bar represent frame bars. The general format is:

Frame-bar, digit1, digit2, digit 3, digit 4, digit 5, check-digit, Frame-bar

See program below for solution: