/** * Title: Chapter 3, "Control Statements" * Description: Chapter 3 Examples * Copyright: Copyright (c) 2000 * Company: Armstrong Atlantic State University * @author Y. Daniel Liang * @version 1.0 */ // TestMulTable.java: Display a multiplication table public class TestMulTable { /**Main method*/ public static void main(String[] args) { // Display the table heading System.out.println(" Multiplication Table"); System.out.println("-----------------------------------"); // Display the number title System.out.print(" | "); for (int j=1; j<=9; j++) System.out.print(" " + j); System.out.println(" "); // Print table body for (int i=1; i<=9; i++) { System.out.print(i+" | "); for (int j=1; j<=9; j++) { // Display the product and align properly if (i*j < 10) System.out.print(" " + i*j); else System.out.print(" " + i*j); } System.out.println(); } } }