Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MultiplicationTableWithoutFormatter {
- public static void main(String[] args) {
- StringBuilder sb = new StringBuilder();
- sb.append(" |");
- for (int i = 1; i < 10; i++) sb.append(" " + i);
- sb.append("\n");
- for (int i = 0; i < 3 * 9 + 2; i++) sb.append("-");
- sb.append("\n");
- for (int i = 1; i < 10; i++) {
- sb.append("" + i + "|");
- for (int j = 1; j < 10; j++) {
- int mul = i * j;
- if (mul < 10) sb.append(" " + mul);
- else sb.append(" " + mul);
- }
- sb.append("\n");
- }
- System.out.print(sb);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement