/* An example of nested loops.. Laura Toma csci 101 */ public class Stars { public static void main (String args[]) { ReadStream r = new ReadStream(); int n; System.out.print("Enter a number and I'll draw a pattern of stars for you: "); n = r.readInt(); r.readLine(); int i, j; i=1; while (i <= n) { //draw a line of n stars j=1; while (j <= i/2) { System.out.print("*"); j = j+1; } //print a newline after each line of n stars System.out.println(); i = i+1; } System.out.println("Goodbye."); } //end of main } // end of class