I have an assignment that follows " Write a code segement using a for loop that, given a positive integer n, prints first n postive integers, such that each integer is preceded by n number of asterisks. EX. if n = 3 output would be *1**2***3
I have the loop working correctly enough that it prints an asterisk and the incrementing numbers, but I can't seem to figure out to get the correct number of asterisks before each number. Here is what I have so far.
for (int x = 1; x <= n; x++)
{
System.out.println("*");
System.out.println(x);
}
what that would print is like n = 3 output would be *1*2*3. How do I get the asterisks to increment as well? THANKS!