No one in my residence hall knows how to do this question on our CS homework. It says:
The nested loops
for(int i = 1; i <= height; i++)
{
for(int j = 1; j <= width; j++)
{
System.out.print("*");
}
System.out.println();
}
displays a rectangle of a given width and height, such as
****
****
****
for a width of 4 and a height of 3. Write a single for loop that displays the same rectangle. Remember that 3 and 4 are only an example, and your code must be general and work for any width and height.
We have tried many things but each one ends in failure. Are we missing something obvious?