-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExercise28.java
More file actions
29 lines (26 loc) · 1.07 KB
/
Exercise28.java
File metadata and controls
29 lines (26 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
public class Exercise28 {
public static void main(String arg[]) {
// Same as Exercise27, but this time, DO worry about the exact spacing,
// and also add some extra output using dashes and bars to make the output
// look much nicer, like this:
//
// Please enter a number (from 1 to 9): 6
// Here is your multiplication table:
// 1 2 3 4 5 6
// +------------------+
// 1 | 1 2 3 4 5 6 |
// 2 | 2 4 6 8 10 12 |
// 3 | 3 6 9 12 15 18 |
// 4 | 4 8 12 16 20 24 |
// 5 | 5 10 15 20 25 30 |
// 6 | 6 12 18 24 30 36 |
// +------------------+
//
// You can assume the number N is no more than 9, so the numbers in
// the table will be two digits each, at most.
// Hint: if a number is less than 10, print a space before the number.
// Hint: System.out.print("---") repeated in a loop will be handy.
System.out.print("Please enter a number (from 1 to 9): ");
int N = StdIn.readInt();
}
}