CSci 101: Homework 4


Objectives. In this homework you'll work with two-dimensional arrays.

Problem. Multiplication table.

Your program should ask the user how big a multiplication table should be printed. Then create a two-dimensional array to hold the table. Then store the correct values in the table. Finally, print out the table.

Sample Execution.

$ java Times
This program prints a multiplication table.
How large do you want it to be? 5

       1   2   3   4   5
     --- --- --- --- ---
  1 |  1   2   3   4   5
  2 |  2   4   6   8  10
  3 |  3   6   9  12  15
  4 |  4   8  12  16  20
  5 |  5  10  15  20  25
$ 

Try to get the columns to line up. One way to do that is by using tabs. The instruction

will print a tab.