/* Lucas Amundson Computer Science 107 February 22nd 2006 In-class assignment on nested loops In this assignment, the user will enter a number less than 10 and the program will evaluate and print out a user friendly multiplication table. */ public class NestedMultiply{ public static void main (String args[]) { // variable to read from user ReadStream r = new ReadStream(); // declare variable int n; // print message and read integer from the user System.out.print("\n" + "Please enter a number, and I will computre the multiplication table for you: "); n = r.readInt(); r.readLine(); // print out response report System.out.println("You typed in " + n + ". Here is the multiplication table:" + "\n"); // declare new variables int i, j; // nested loop for multiplication table i=1; while (i <= n) { j=1; while (j <= n) { if (i*j <= 9) System.out.print(i*j + " "); if (i*j >= 10) System.out.print(i*j + " "); j = j+1; } System.out.println(); i = i+1; } System.out.println(); } // end of main } // end of class