Gray code and BCD converter

Convert decimal numbers to binary, Gray code and binary-coded decimal (BCD), and back.