This straightforward Code Kata involves reproducing the display of an old-fashioned LCD (or LED if you prefer) calculator. It’s Beginner Level, but has a few interesting twists.
An old-style electronic calculator displays numbers on a simple LCD display. Each element in the display is made up of seven lines, which are lit in such a way as to show the number. The numbers usually look something like this:
Write a program that takes an integer as its input (use the command line if you want), and then displays the number as it would appear on an LCD display.
Note that a calculator’s display is limited in width. We will assume that there are eight elements in the display, so an attempt to display any larger integer will result in an error. (Obviously this error should also be displayed LCD-style.)
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.