Hi,
I need to show stars equal to the each number of an array. I think I need another for statement. I`ve tried, but in vain. I do not know which variables should be included in this for statement ??
the output should be :
0|****(4)
1|**(2)
2|*********(9) and so forth.
/** This program will calculate the numbers of
stars equal to each element of the array.
*/
public class StarNumber {
public static void main(String args[]) {
int[] numbers={4,2,9,12,8,3,7};
for (int index=0; index<numbers.length; index++)
System.out.println((index) + "|*" + numbers[index]);
}
}
my output :
0|*4
1|*2
2|*9
3|*12
4|*8
5|*3
6|*7