Task

Produce a formatted   12×12   multiplication table of the kind memorized by rote when in primary (or elementary) school.



Only print the top half triangle of products.




fcn multiplicationTable(n){
   w,fmt := (n*n).numDigits, " %%%dd".fmt(w).fmt;  // eg " %3".fmt
   header:=[1..n].apply(fmt).concat();	   // 1  2  3  4 ...
   println(" x ", header, "\n   ", "-"*header.len());
   dash:=String(" "*w,"-");	// eg "   -"
   foreach a in ([1..n]){
      print("%2d|".fmt(a),dash*(a-1));
      [a..n].pump(String,'*(a),fmt).println();
   }
}(12);