import java.util.Scanner; import java.util.jar.JarOutputStream;
public class Main {
public static void main(String[] args) {
System.out.println("1 2 3 4 5 6 7 8 9");
System.out.println("- - - - - - - - -");
for (int i = 1; i <= 9; i++) {
for (int j = 1; j <= 9; j++) {
if (i * j < 10) {
System.out.print(i * j + " ");
} else {
System.out.print(i * j + " ");
}
}
System.out.println();
}
System.out.println();
System.out.println("1 2 3 4 5 6 7 8 9");
System.out.println("- - - - - - - - -");
for (int i = 1; i <= 9; i++) {
for (int j = 1; j <= i; j++) {
if (i * j < 10) {
System.out.print(i * j + " ");
} else {
System.out.print(i * j + " ");
}
}
System.out.println();
}
System.out.println();
System.out.println("1 2 3 4 5 6 7 8 9");
System.out.println("- - - - - - - - -");
int space = 0;
for (int i = 1;i<=9;i++){
for (int j = 1;j<i;j++){
if (i*j<10){
System.out.print(" ");
}else {
System.out.print(" ");
}
}
for (int k = i;k<=9;k++){
if (i * k < 10) {
System.out.print(i * k + " ");
} else {
System.out.print(i * k + " ");
}
}
System.out.println();
}
}
}
不是 -
(短横线),是 _
(下划线)