#K86937. 7-Segment Display Codes Generation
7-Segment Display Codes Generation
7-Segment Display Codes Generation
You are given the task of generating the 7-bit binary codes used in a 7-segment LED display for digits from 0 to 9. Each digit is represented by a unique 7-bit binary number that indicates which segments are turned ON. For example, the digit 0 is represented by the bit pattern \(0111111\) (which is \(0x3F\) in hexadecimal), meaning that all segments except the middle one are lit.
Your program does not take any input; it should output the list of 7-segment codes for digits 0 to 9 separated by spaces. The expected output is:
63 6 91 79 102 109 125 7 127 111
Note that the binary values can be interpreted as:
- 0: \(0b0111111\) or 63
- 1: \(0b0000110\) or 6
- 2: \(0b1011011\) or 91
- 3: \(0b1001111\) or 79
- 4: \(0b1100110\) or 102
- 5: \(0b1101101\) or 109
- 6: \(0b1111101\) or 125
- 7: \(0b0000111\) or 7
- 8: \(0b1111111\) or 127
- 9: \(0b1101111\) or 111
Make sure your solution reads from standard input (stdin) and writes to standard output (stdout) even though there is no meaningful input provided.
inputFormat
The problem does not require any input. However, your solution should still read from stdin
if necessary (it can ignore the input).
outputFormat
The output should be a single line containing the 7-segment display codes for digits 0 to 9, separated by spaces. The expected output is:
63 6 91 79 102 109 125 7 127 111## sample
dummy input
63 6 91 79 102 109 125 7 127 111