Due: Monday, June 2
Goal: More practice with loops
The following chunk of code outputs a right triangle of *'s:
int i=9, width=10;
while (i>0)
{
int j = 1;
while (j <= i)
{
System.out.print(" ");
j++;
}
while (j <= width)
{
System.out.print("*");
j++;
}
System.out.println();
i--;
}
Rewrite this code so it does the same thing except uses for loops intead of while loops.