Advertisement
cd62131

MultiplicationTableWithoutStringBuilder

Jul 11th, 2014
449
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.60 KB | None | 0 0
  1. public class MultiplicationTableWithoutStringBuilder {
  2.   public static void main(String[] args) {
  3.     System.out.print(" |");
  4.     for (int i = 1; i < 10; i++) System.out.print("  " + i);
  5.     System.out.println();
  6.     for (int i = 0; i < 3 * 9 + 2; i++) System.out.print("-");
  7.     System.out.println();
  8.     for (int i = 1; i < 10; i++) {
  9.       System.out.print("" + i + "|");
  10.       for (int j = 1; j < 10; j++) {
  11.         int mul = i * j;
  12.         if (mul < 10)
  13.           System.out.print("  " + mul);
  14.         else
  15.           System.out.print(" " + mul);
  16.       }
  17.       System.out.println();
  18.     }
  19.   }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement