int a1 = 1; int b1 = 1; int c1 = 1; while (a1 <= 9) { while (b1 <= a1) { c1 = a1 * b1; System.out.print(b1 + "X" + a1 + "=" + c1 + "\t"); b1++; } System.out.println(); a1++; b1 = 1; }
for (int k = 1; k <= 9; k++) System.out.printf("%5d", k); for (int i = 1; i <= 9; i++) { System.out.println(); System.out.printf("%-4d", i); for (int j = 1; j <= i; j++) System.out.printf("%-5d", i * j); }
int x, y; for (x = 0; x <= 9; x++) { for (y = 1; y <= x; y++) { System.out.print(y + "X" + x + "=" + x * y + "\t"); } System.out.println(); }
int i, j, k; for (i = 9; i >= 1; i--) { for (j = 1; j <= i; j++) { k = i * j; System.out.print(j + "*" + i + "=" + k + "\t"); } System.out.println(); }