Problem J1: 0123456789

Most digital devices show numbers using a seven segment display. The seven segments are arranged as shown:

``` * * *
*     *
*     *
*     *
* * *
*     *
*     *
*     *
* * *
```

For this problem each segment is represented by three asterisks in a line as shown above. Any digit from 0-9 can be shown by illuminating the appropriate segments. For example the digit 1 may be displayed using the two segments on the right side:

```      *
*
*

*
*
*```

The digit 4 needs four segments to display it properly:

```*     *
*     *
*     *
* * *
*
*
*```

Write a program that will accept a single digit input from the user, and then display that digit using a seven segment display. You may assume that each segment is composed of three asterisks.

`9`

Sample Output

``` * * *
*     *
*     *
*     *
* * *
*
*
*
* * *```

Point Value: 3
Time Limit: 2.00s
Memory Limit: 16M
Added: Oct 01, 2008

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

Comments (Search)

• (0/0)
beware, the horizontal lines are made of three asterisks and spaces between them
* * *, not ***

• (1/1)
My third test case is saying that it is wrong, please can anybody help me!
My problem is that in the test case it is show some weird clipped area. Can someone help me ?

• (1/1)
The output shown will always be clipped.

• (0/0)
why is it clipped though?

• (0/0)
If you get a typo, showing the entire output would be too obvious. Clipping the output lets you to figure the problem with the code out yourself.

• (0/0)
My code passes all the test cases but the last one. could someone help?

• (4/3)
Whats the point of this question? Hardcoding skills?

• (1/1)
i agree that there doesn't have much more than hardcoding

• (1/0)
The point being that this is a CCC question. Like it or not, this is what you can expect on the CCC, so it's here for practice.

• (0/4)
i mean, really. in javascript, this is really easy, just do:
if(n == 1){
System.out.println("*
*
*

*
*
*
}

• (6/0)
That's not a cheat.
And that's not Javascript.
And don't post answers.

• (0/3)
hey ken
you lousy punkass bitch

• (4/1)
I don't remember swearing being allowed

• (0/1)
the 1st test case doesn't work, what does it mean by clipped? How to fix?

• (1/1)
Clipped means that the judge doesn't show all of your output. It will only show a few lines of output. Your output is just wrong(try checking if it exactly matches the output)

• (0/2)
I believe that my code worked, but apparently not...

• (4/1)
Look at the segments at the top of the problem statements and compare how those segments look to how your program prints them.

• (0/2)
thanks

• (1/2)
Spaces?

• (1/1)
Yes, make sure spaces are present between the asteriks going horizontal.