go to previous page   go to home page   go to next page hear noise

What would the program do if the user asked for a negative number of stars per line?

Answer:

Each line would consist of nothing but the end of line character that System.out.println()prints. The inner loop would not execute even once.


Live Code!

For your amusement and entertainment here is a JavaScript version of the program:

How Many Rows: How Many Stars:

QUESTION 23:

On a clear evening, out in the country, far from city lights, about 6,000 stars are visible. Enter values so the program prints that many stars.

(If you ask for for than 70 stars per line, the excess stars for each line will print on a second line.)