I have an array with repetitions of numbers and I need to show them in an "histogram" made by "*". The histogram should looks like this:
*
* *
* * *
* * * *
* * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
1 2 3 4 5 6 7 8 9 10
I have this array
int[] repetition = new int[] {4,6,4,4,6,5,7,4,3,3};
and I was able to print it horizontally like this:
1*****
2******
3****
4****
5******
6*****
7*******
8****
9***
10***
How can I create the vertical histogram?
First you compute the maximum height of the histogram.
Then, you print like this, from top to bottom:
PS: This is just an idea, not a complete working code, and it works only for positive height values!