Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Multiplication Table in Various Programming Languages

趙惟倫
September 18, 2018

Multiplication Table in Various Programming Languages

趙惟倫

September 18, 2018
Tweet

More Decks by 趙惟倫

Other Decks in Programming

Transcript

  1. Wei-Lun Chao <[email protected]> 18 Sep. 2018 Multiplication Table in Various

    Multiplication Table in Various Programming Languages Programming Languages TOSSUG
  2. Beginner's practices Beginner's practices 1st program Hello, World! 2nd program

    Multiplication Table <https://github.com/bluebat/mt9x9> 3rd program Fibonacci Number ? 1x1= 1 2x1= 2 3x1= 3 1x2= 2 2x2= 4 3x2= 6 1x3= 3 2x3= 6 3x3= 9 1x4= 4 2x4= 8 3x4=12 1x5= 5 2x5=10 3x5=15 1x6= 6 2x6=12 3x6=18 1x7= 7 2x7=14 3x7=21 1x8= 8 2x8=16 3x8=24 1x9= 9 2x9=18 3x9=27 4x1= 4 5x1= 5 6x1= 6 4x2= 8 5x2=10 6x2=12 4x3=12 5x3=15 6x3=18 4x4=16 5x4=20 6x4=24 4x5=20 5x5=25 6x5=30 4x6=24 5x6=30 6x6=36 4x7=28 5x7=35 6x7=42 4x8=32 5x8=40 6x8=48 4x9=36 5x9=45 6x9=54 7x1= 7 8x1= 8 9x1= 9 7x2=14 8x2=16 9x2=18 7x3=21 8x3=24 9x3=27 7x4=28 8x4=32 9x4=36 7x5=35 8x5=40 9x5=45 7x6=42 8x6=48 9x6=54 7x7=49 8x7=56 9x7=63 7x8=56 8x8=64 9x8=72 7x9=63 8x9=72 9x9=81
  3. Code to Code Code to Code #!/usr/bin/basica 1 REM ./mt9x9.BAS

    || basica mt9x9.BAS 10 FOR I = 1 TO 9 STEP 3 20 FOR J = 1 TO 9 30 FOR K = I TO I+2 40 PRINT USING "#x#=##"+CHR$(9); K, J, K*J; 50 NEXT 60 PRINT CHR$(10); 70 NEXT 80 PRINT 90 NEXT #!/usr/bin/basica 1 REM ./mt9x9.BAS || basica mt9x9.BAS 10 FOR I = 1 TO 9 STEP 3 20 FOR J = 1 TO 9 30 FOR K = I TO I+2 40 PRINT USING "#x#=##"+CHR$(9); K, J, K*J; 50 NEXT 60 PRINT CHR$(10); 70 NEXT 80 PRINT 90 NEXT #!/usr/bin/bas rem ./mt9x9.qbs || bas mt9x9.qbs for i% = 1 to 9 step 3 for j% = 1 to 9 for k% = i% to i%+2 print using "#x#=##"+chr$(9); k%, j%, k%*j%; next k% print chr$(10); next j% print next i% #!/usr/bin/bas rem ./mt9x9.qbs || bas mt9x9.qbs for i% = 1 to 9 step 3 for j% = 1 to 9 for k% = i% to i%+2 print using "#x#=##"+chr$(9); k%, j%, k%*j%; next k% print chr$(10); next j% print next i% QBASIC BASICA
  4. Code to Code Code to Code ‘ oscript mt9x9.vbs For

    i = 1 To 9 Step 3 For j = 1 To 9 s = "" For k = i To i+2 s = s+CStr(k)+"x"+CStr(j)+"=" If k*j < 10 Then s = s+" " End If s = s+CStr(k*j)+vbTab Next Wscript.Echo s Next Wscript.Echo "" Next ‘ oscript mt9x9.vbs For i = 1 To 9 Step 3 For j = 1 To 9 s = "" For k = i To i+2 s = s+CStr(k)+"x"+CStr(j)+"=" If k*j < 10 Then s = s+" " End If s = s+CStr(k*j)+vbTab Next Wscript.Echo s Next Wscript.Echo "" Next Rem vbnc mt9x9.vbn && mono mt9x9.exe Imports System.Console Module mt9x9 Sub Main() Dim i, j, k As Integer For i = 1 to 9 step 3 For j = 1 to 9 For Each k In New Integer() {i, i+1, i+2} Write("{0}x{1}={2,2}{3}", k, j, k*j, vbTab) Next Write(vbLf) Next WriteLine() Next End Sub End Module Rem vbnc mt9x9.vbn && mono mt9x9.exe Imports System.Console Module mt9x9 Sub Main() Dim i, j, k As Integer For i = 1 to 9 step 3 For j = 1 to 9 For Each k In New Integer() {i, i+1, i+2} Write("{0}x{1}={2,2}{3}", k, j, k*j, vbTab) Next Write(vbLf) Next WriteLine() Next End Sub End Module VB.NET VBScript
  5. Code to Code Code to Code ; pbcompiler mt9x9.pb -o

    mt9x9 && ./mt9x9 OpenConsole() For i = 1 To 9 Step 3 For j = 1 To 9 For k = i To i+2 Print(Str(k)+"x"+Str(j)+"="+RSet(Str(k*j),2)+Chr(9)) Next k Print(~"\n") Next j PrintN("") Next i CloseConsole() ; pbcompiler mt9x9.pb -o mt9x9 && ./mt9x9 OpenConsole() For i = 1 To 9 Step 3 For j = 1 To 9 For k = i To i+2 Print(Str(k)+"x"+Str(j)+"="+RSet(Str(k*j),2)+Chr(9)) Next k Print(~"\n") Next j PrintN("") Next i CloseConsole() ' fbc mt9x9.bas && ./mt9x9 for i as integer = 1 to 9 step 3 for j as integer = 1 to 9 for k as integer = i to i+2 print using "#x#=##"+chr(9); k; j; k*j; next k print chr(10); next j print next i ' fbc mt9x9.bas && ./mt9x9 for i as integer = 1 to 9 step 3 for j as integer = 1 to 9 for k as integer = i to i+2 print using "#x#=##"+chr(9); k; j; k*j; next k print chr(10); next j print next i FreeBasic PureBasic
  6. Code to Code Code to Code #!/usr/bin/ring // ./mt9x9.ring ||

    ring mt9x9.ring for i = 1 to 9 step 3 for j = 1 to 9 for k in [i, i+1, i+2] see "" + k + "x" + j + "=" if k*j<10 see " " ok see "" + k*j + tab next put nl next ? "" next #!/usr/bin/ring // ./mt9x9.ring || ring mt9x9.ring for i = 1 to 9 step 3 for j = 1 to 9 for k in [i, i+1, i+2] see "" + k + "x" + j + "=" if k*j<10 see " " ok see "" + k*j + tab next put nl next ? "" next #!/usr/bin/phix -- ./mt9x9.ex || phix mt9x9.ex for i = 1 to 9 by 3 do for j = 1 to 9 do for k = i to i+2 do printf(1, "%dx%d=%2d\t", {k,j,k*j}) end for puts(1, "\n") end for puts(1, "\n") end for #!/usr/bin/phix -- ./mt9x9.ex || phix mt9x9.ex for i = 1 to 9 by 3 do for j = 1 to 9 do for k = i to i+2 do printf(1, "%dx%d=%2d\t", {k,j,k*j}) end for puts(1, "\n") end for puts(1, "\n") end for Euphoria Ring
  7. Code to Code Code to Code 00.03 COMMENT focal mt9x9.fc

    01.01 FOR I=1,3,9; DO 02 01.02 QUIT 02.01 FOR J=1,1,9; DO 03 02.02 TYPE ! 02.03 RETURN 03.01 FOR K=I,1,I+2; DO 04 03.02 TYPE ! 03.03 RETURN 04.01 SET S=K; DO 05 04.02 TYPE "x" 04.03 SET S=J; DO 05 04.04 TYPE "=" 04.05 SET S=FITR(K*J/10) 04.06 IF (S) 04.07,04.07; DO 05; GOTO 04.08 04.07 TYPE " " 04.08 SET S=(K*J-S*10); DO 05 04.09 TYPE " " 04.10 RETURN 05.01 IF (S-9) 05.02; TYPE "9"; RETURN 05.02 IF (S-8) 05.03; TYPE "8"; RETURN 05.03 IF (S-7) 05.04; TYPE "7"; RETURN 05.04 IF (S-6) 05.05; TYPE "6"; RETURN 05.05 IF (S-5) 05.06; TYPE "5"; RETURN 05.06 IF (S-4) 05.07; TYPE "4"; RETURN 05.07 IF (S-3) 05.08; TYPE "3"; RETURN 05.08 IF (S-2) 05.09; TYPE "2"; RETURN 05.09 IF (S-1) 05.10; TYPE "1"; RETURN 05.10 TYPE "0" 05.11 RETURN 00.03 COMMENT focal mt9x9.fc 01.01 FOR I=1,3,9; DO 02 01.02 QUIT 02.01 FOR J=1,1,9; DO 03 02.02 TYPE ! 02.03 RETURN 03.01 FOR K=I,1,I+2; DO 04 03.02 TYPE ! 03.03 RETURN 04.01 SET S=K; DO 05 04.02 TYPE "x" 04.03 SET S=J; DO 05 04.04 TYPE "=" 04.05 SET S=FITR(K*J/10) 04.06 IF (S) 04.07,04.07; DO 05; GOTO 04.08 04.07 TYPE " " 04.08 SET S=(K*J-S*10); DO 05 04.09 TYPE " " 04.10 RETURN 05.01 IF (S-9) 05.02; TYPE "9"; RETURN 05.02 IF (S-8) 05.03; TYPE "8"; RETURN 05.03 IF (S-7) 05.04; TYPE "7"; RETURN 05.04 IF (S-6) 05.05; TYPE "6"; RETURN 05.05 IF (S-5) 05.06; TYPE "5"; RETURN 05.06 IF (S-4) 05.07; TYPE "4"; RETURN 05.07 IF (S-3) 05.08; TYPE "3"; RETURN 05.08 IF (S-2) 05.09; TYPE "2"; RETURN 05.09 IF (S-1) 05.10; TYPE "1"; RETURN 05.10 TYPE "0" 05.11 RETURN #!/usr/bin/hbrun * ./mt9x9.prg || hbrun mt9x9.prg local i, j, k for i := 1 to 9 step 3 for j := 1 to 9 for each k in {i, i+1, i+2} ?? str(k, 1) + "x" + str(j, 1) + "=" + str(k*j, 2) + chr(9) next ?? chr(10) next ? next #!/usr/bin/hbrun * ./mt9x9.prg || hbrun mt9x9.prg local i, j, k for i := 1 to 9 step 3 for j := 1 to 9 for each k in {i, i+1, i+2} ?? str(k, 1) + "x" + str(j, 1) + "=" + str(k*j, 2) + chr(9) next ?? chr(10) next ? next xBASE Focal
  8. Code to Code Code to Code dnl m4 mt9x9.m4 dnl

    define(`item', `$2x$1=ifelse(eval($2*$1<10), 1, ` ')eval($2*$1) ')dnl ⇥ define(`line', `ifelse(eval($3<=eval($1+2)), 1, item($2, $3)dnl `line($1, $2, incr($3))')')dnl define(`block', `ifelse(eval($2<=9), 1, line($1, $2, $1) `block($1, incr($2))')')dnl define(`main', `ifelse(eval($1<=9), 1, block($1, 1) `main(eval($1+3))')')dnl main(1)dnl dnl dnl m4 mt9x9.m4 dnl define(`item', `$2x$1=ifelse(eval($2*$1<10), 1, ` ')eval($2*$1) ')dnl ⇥ define(`line', `ifelse(eval($3<=eval($1+2)), 1, item($2, $3)dnl `line($1, $2, incr($3))')')dnl define(`block', `ifelse(eval($2<=9), 1, line($1, $2, $1) `block($1, incr($2))')')dnl define(`main', `ifelse(eval($1<=9), 1, block($1, 1) `main(eval($1+3))')')dnl main(1)dnl dnl #!/usr/bin/make -sf # ./mt9x9.mk || make -sf mt9x9.mk include gmsl $(foreach i, 1 4 7, \ $(foreach j, $(call sequence,1,9), \ $(eval str=) \ $(foreach k, $i $(call plus,$i,1) $(call plus,$i,2), \ $(eval n=$(call multiply,$k,$j)) \ $(eval str=${str} $kx$j=$(if $(call lt,$n,10), ,)$n) \ ) \ $(info ${str}) \ ) \ $(info ) \ ) all: #!/usr/bin/make -sf # ./mt9x9.mk || make -sf mt9x9.mk include gmsl $(foreach i, 1 4 7, \ $(foreach j, $(call sequence,1,9), \ $(eval str=) \ $(foreach k, $i $(call plus,$i,1) $(call plus,$i,2), \ $(eval n=$(call multiply,$k,$j)) \ $(eval str=${str} $kx$j=$(if $(call lt,$n,10), ,)$n) \ ) \ $(info ${str}) \ ) \ $(info ) \ ) all: Make M4
  9. Code to Code Code to Code -- sacomp mt9x9.sa -o

    mt9x9 && ./mt9x9 class MAIN is main is loop i ::= 1.stepto!(9, 3); loop j ::= 1.upto!(9); k:ARRAY{INT} := |i, i+1, i+2|; loop #OUT+ k.elt!+"x"+j+"="+#FMT("%2d", k.elt!*j)+"\t" end; #OUT+ "\n"; end; #OUT+ "\n"; end end end -- sacomp mt9x9.sa -o mt9x9 && ./mt9x9 class MAIN is main is loop i ::= 1.stepto!(9, 3); loop j ::= 1.upto!(9); k:ARRAY{INT} := |i, i+1, i+2|; loop #OUT+ k.elt!+"x"+j+"="+#FMT("%2d", k.elt!*j)+"\t" end; #OUT+ "\n"; end; #OUT+ "\n"; end end end module: mt9x9 // make-dylan-app mt9x9; mv mt9x9.dylan mt9x9; cd mt9x9; // dylan-compiler -build mt9x9.lid && _build/bin/mt9x9 for (i from 1 below 10 by 3) for (j from 1 to 9) for (k from i to i + 2) format-out("%dx%d=%2d\t", k, j, k * j); end; format-out("\n"); end; format-out("\n"); end; module: mt9x9 // make-dylan-app mt9x9; mv mt9x9.dylan mt9x9; cd mt9x9; // dylan-compiler -build mt9x9.lid && _build/bin/mt9x9 for (i from 1 below 10 by 3) for (j from 1 to 9) for (k from i to i + 2) format-out("%dx%d=%2d\t", k, j, k * j); end; format-out("\n"); end; format-out("\n"); end; Dylan Sather
  10. Code to Code Code to Code #!/usr/bin/agena # ./mt9x9.agn ||

    agena mt9x9.agn for i from 1 to 9 by 3 do for j from 1 to 9 do for k in [i, i+1, i+2] do printf('%dx%d=%2d\t', k, j, k*j) od; print() od; writeline() od; #!/usr/bin/agena # ./mt9x9.agn || agena mt9x9.agn for i from 1 to 9 by 3 do for j from 1 to 9 do for k in [i, i+1, i+2] do printf('%dx%d=%2d\t', k, j, k*j) od; print() od; writeline() od; #!/usr/bin/kite # ./mt9x9.kite || kite mt9x9.kite i = 1; while(i <= 9) [ j = 1; while(j <= 9) [ k = i; s = ""; until(k > 2+i) [ s = s + ("%dx%d=%2d\t" | format([k, j, k*j])); k = k + 1; ]; s | print; j = j + 1; ]; "" | print; i = i + 3; ]; #!/usr/bin/kite # ./mt9x9.kite || kite mt9x9.kite i = 1; while(i <= 9) [ j = 1; while(j <= 9) [ k = i; s = ""; until(k > 2+i) [ s = s + ("%dx%d=%2d\t" | format([k, j, k*j])); k = k + 1; ]; s | print; j = j + 1; ]; "" | print; i = i + 3; ]; Kite Agena
  11. Code to Code Code to Code comment awe mt9x9.alw -o

    mt9x9 && ./mt9x9 ; begin for i := 1 step 3 until 9 do begin for j := 1 until 9 do begin for k := i, i+1, i+2 do begin writeon(i_w := 1, s_w := 0, k, "x", j, "="); writeon(i_w := 2, s_w := 2, k*j) end k; write(code(0)) end j; write() end i end. comment awe mt9x9.alw -o mt9x9 && ./mt9x9 ; begin for i := 1 step 3 until 9 do begin for j := 1 until 9 do begin for k := i, i+1, i+2 do begin writeon(i_w := 1, s_w := 0, k, "x", j, "="); writeon(i_w := 2, s_w := 2, k*j) end k; write(code(0)) end j; write() end i end. % cim mt9x9.sim && ./mt9x9 Begin Integer i, j, k; For i := 1 Step 3 Until 9 Do Begin For j := 1 Step 1 Until 9 Do Begin For k := i Step 1 Until i+2 Do Begin OutInt(k, 0); OutText("x"); OutInt(j, 0); OutText("="); OutInt(k*j, 2); OutText("!9!") End; OutImage End; OutImage End End % cim mt9x9.sim && ./mt9x9 Begin Integer i, j, k; For i := 1 Step 3 Until 9 Do Begin For j := 1 Step 1 Until 9 Do Begin For k := i Step 1 Until i+2 Do Begin OutInt(k, 0); OutText("x"); OutInt(j, 0); OutText("="); OutInt(k*j, 2); OutText("!9!") End; OutImage End; OutImage End End Simula Algol
  12. Code to Code Code to Code (* obnc mt9x9.obn &&

    ./mt9x9 *) MODULE mt9x9; IMPORT Out; VAR i, j, k : INTEGER; BEGIN FOR i := 1 TO 9 BY 3 DO FOR j := 1 TO 9 DO FOR k := i TO i+2 DO Out.Int(k,1); Out.String("x"); Out.Int(j,1); Out.String("="); Out.Int(k*j,2); Out.Char(09X) END; Out.Char(0AX) END; Out.Ln END END mt9x9. (* obnc mt9x9.obn && ./mt9x9 *) MODULE mt9x9; IMPORT Out; VAR i, j, k : INTEGER; BEGIN FOR i := 1 TO 9 BY 3 DO FOR j := 1 TO 9 DO FOR k := i TO i+2 DO Out.Int(k,1); Out.String("x"); Out.Int(j,1); Out.String("="); Out.Int(k*j,2); Out.Char(09X) END; Out.Char(0AX) END; Out.Ln END END mt9x9. (* m2c -all mt9x9.mod -o mt9x9 && ./mt9x9 *) MODULE mt9x9; IMPORT InOut; VAR i, j, k: CARDINAL; BEGIN FOR i:=1 TO 9 BY 3 DO FOR j:=1 TO 9 DO FOR k:=i TO i+2 DO InOut.WriteInt(k, 1); InOut.Write('x'); InOut.WriteInt(j, 1); InOut.Write('='); InOut.WriteInt(k*j, 2); InOut.Write(11C); END; InOut.Write(12C); END; InOut.WriteLn; END; END mt9x9. (* m2c -all mt9x9.mod -o mt9x9 && ./mt9x9 *) MODULE mt9x9; IMPORT InOut; VAR i, j, k: CARDINAL; BEGIN FOR i:=1 TO 9 BY 3 DO FOR j:=1 TO 9 DO FOR k:=i TO i+2 DO InOut.WriteInt(k, 1); InOut.Write('x'); InOut.WriteInt(j, 1); InOut.Write('='); InOut.WriteInt(k*j, 2); InOut.Write(11C); END; InOut.Write(12C); END; InOut.WriteLn; END; END mt9x9. Modula-2 Oberon
  13. Code to Code Code to Code -- gnat make mt9x9.adb

    && ./mt9x9 with Ada.Text_IO; use Ada.Text_IO; procedure mt9x9 is package IO is new Integer_IO (Integer); use IO; V : array (1..3) of Integer := (1, 4, 7); begin for i of V loop for j in 1..9 loop for k in i..i+2 loop Put (k, Width => 1); Put ("x"); Put (j, Width => 1); Put ("="); Put (k*j, Width => 2); Put (ASCII.HT); end loop; Put_Line (""); end loop; New_Line; end loop; end mt9x9; -- gnat make mt9x9.adb && ./mt9x9 with Ada.Text_IO; use Ada.Text_IO; procedure mt9x9 is package IO is new Integer_IO (Integer); use IO; V : array (1..3) of Integer := (1, 4, 7); begin for i of V loop for j in 1..9 loop for k in i..i+2 loop Put (k, Width => 1); Put ("x"); Put (j, Width => 1); Put ("="); Put (k*j, Width => 2); Put (ASCII.HT); end loop; Put_Line (""); end loop; New_Line; end loop; end mt9x9; #!/usr/bin/spar -- ./mt9x9.sp || spar mt9x9.sp procedure mt9x9 is begin i := 1; while i <= 9 loop for j in 1..9 loop for k in i..i+2 loop put(k, "9"); put("x"); put(j, "9"); put("="); put(k*j, "Z9"); put(ASCII.HT); end loop; put_line(""); end loop; new_line; i := @ + 3; end loop; end mt9x9; #!/usr/bin/spar -- ./mt9x9.sp || spar mt9x9.sp procedure mt9x9 is begin i := 1; while i <= 9 loop for j in 1..9 loop for k in i..i+2 loop put(k, "9"); put("x"); put(j, "9"); put("="); put(k*j, "Z9"); put(ASCII.HT); end loop; put_line(""); end loop; new_line; i := @ + 3; end loop; end mt9x9; AdaScript Ada
  14. Code to Code Code to Code { fpc mt9x9.pas &&

    ./mt9x9 } program mt9x9; uses SysUtils; var i, j, k : Integer; begin for i in [1, 4, 7] do begin for j := 1 to 9 do begin for k := i to i+2 do begin Write(Format('%dx%d=%2d'#9, [k, j, k*j])); end; Write(#10); end; Writeln; end; end. { fpc mt9x9.pas && ./mt9x9 } program mt9x9; uses SysUtils; var i, j, k : Integer; begin for i in [1, 4, 7] do begin for j := 1 to 9 do begin for k := i to i+2 do begin Write(Format('%dx%d=%2d'#9, [k, j, k*j])); end; Write(#10); end; Writeln; end; end. Pascal /* plic -C -dELF -lsiaxgo -ew mt9x9.pli -o mt9x9.o ld -z muldefs -Bstatic --oformat=elf32-i386 \ -melf_i386 -e main mt9x9.o libprf.a -o mt9x9 */ mt9x9: proc options(main); dcl(i, j, k) fixed dec(1); do i = 1 to 9 by 3; do j = 1 to 9; do k = i to i+2; put edit (k, 'x', j, '=', k*j) (P'9', A, P'9', A, P'Z9'); put edit ('09'X) (A); end; put skip edit ('') (A); end; put skip edit ('') (A); end; end mt9x9; /* plic -C -dELF -lsiaxgo -ew mt9x9.pli -o mt9x9.o ld -z muldefs -Bstatic --oformat=elf32-i386 \ -melf_i386 -e main mt9x9.o libprf.a -o mt9x9 */ mt9x9: proc options(main); dcl(i, j, k) fixed dec(1); do i = 1 to 9 by 3; do j = 1 to 9; do k = i to i+2; put edit (k, 'x', j, '=', k*j) (P'9', A, P'9', A, P'Z9'); put edit ('09'X) (A); end; put skip edit ('') (A); end; put skip edit ('') (A); end; end mt9x9; PL/I
  15. Code to Code Code to Code #!/usr/bin/s7 # s7c mt9x9.sd7

    && ./mt9x9 || s7 mt9x9.sd7 || ./mt9x9.sd7 $ include "seed7_05.s7i"; const proc: main is func local var integer: i is 1; var integer: j is 1; var integer: k is 1; begin for i range 1 to 9 step 3 do for j range 1 to 9 do for k range [](i, i+1, i+2) do write(k <& "x" <& j <& "=" <& k*j lpad 2 <& "\t"); end for; write("\n"); end for; writeln; end for; end func; #!/usr/bin/s7 # s7c mt9x9.sd7 && ./mt9x9 || s7 mt9x9.sd7 || ./mt9x9.sd7 $ include "seed7_05.s7i"; const proc: main is func local var integer: i is 1; var integer: j is 1; var integer: k is 1; begin for i range 1 to 9 step 3 do for j range 1 to 9 do for k range [](i, i+1, i+2) do write(k <& "x" <& j <& "=" <& k*j lpad 2 <& "\t"); end for; write("\n"); end for; writeln; end for; end func; Seed7 % sisalc -fileio mt9x9.sis -o mt9x9 && ./mt9x9 define main type string = array[character]; function main(returns string) for i in array[1: 1, 4, 7] cross j in 1, 9 cross k in i, i+2 s := array[1: character(48+k),'x',character(48+j),'='] || if k*j < 10 then array[1: ' ',character(48+k*j)] else array[1: character(48+k*j/10),character(48+mod(k*j,10))] end if || if k ~= i+2 then array[1: '\t'] elseif j = 9 then array[1: '\n','\n'] else array[1: '\n'] end if returns value of catenate s end for end function % sisalc -fileio mt9x9.sis -o mt9x9 && ./mt9x9 define main type string = array[character]; function main(returns string) for i in array[1: 1, 4, 7] cross j in 1, 9 cross k in i, i+2 s := array[1: character(48+k),'x',character(48+j),'='] || if k*j < 10 then array[1: ' ',character(48+k*j)] else array[1: character(48+k*j/10),character(48+mod(k*j,10))] end if || if k ~= i+2 then array[1: '\t'] elseif j = 9 then array[1: '\n','\n'] else array[1: '\n'] end if returns value of catenate s end for end function SISAL
  16. Code to Code Code to Code (* ocamlc mt9x9.ml &&

    ./mt9x9 || ocaml mt9x9.ml *) for i = 1 to 3 do for j = 1 to 9 do for k = i*3-2 to i*3 do Printf.printf "%dx%d=%2d\t" k j (k*j) done; print_string "\n" done; print_newline() done; (* ocamlc mt9x9.ml && ./mt9x9 || ocaml mt9x9.ml *) for i = 1 to 3 do for j = 1 to 9 do for k = i*3-2 to i*3 do Printf.printf "%dx%d=%2d\t" k j (k*j) done; print_string "\n" done; print_newline() done; (* mlton mt9x9.sml && ./mt9x9 *) val i = ref 1; val j = ref 1; val k = ref 1; while (!i <= 7) do ( j := 1; while (!j <= 9) do ( k := !i; while (!k <= (!i + 2)) do ( print (Int.toString (!k) ^ "x" ^ Int.toString (!j) ^ "="); print (if (!k * !j) < 10 then " " else ""); print (Int.toString (!k * !j) ^ "\t"); k := !k + 1 ); print "\n"; j := !j + 1 ); print "\n"; i := !i + 3 ); (* mlton mt9x9.sml && ./mt9x9 *) val i = ref 1; val j = ref 1; val k = ref 1; while (!i <= 7) do ( j := 1; while (!j <= 9) do ( k := !i; while (!k <= (!i + 2)) do ( print (Int.toString (!k) ^ "x" ^ Int.toString (!j) ^ "="); print (if (!k * !j) < 10 then " " else ""); print (Int.toString (!k * !j) ^ "\t"); k := !k + 1 ); print "\n"; j := !j + 1 ); print "\n"; i := !i + 3 ); SML Caml
  17. Code to Code Code to Code #!/usr/bin/logo ; ./mt9x9.logo ||

    logo mt9x9.logo for [i 1 9 3] [ for [j 1 9] [ for [k :i :i+2] [ (type :k "x :j "= form :k*:j 2 0 char 9) ] (type char 10) ] (print) ] bye #!/usr/bin/logo ; ./mt9x9.logo || logo mt9x9.logo for [i 1 9 3] [ for [j 1 9] [ for [k :i :i+2] [ (type :k "x :j "= form :k*:j 2 0 char 9) ] (type char 10) ] (print) ] bye #!/usr/bin/axi # axc mt9x9.als && axi mt9x9.axc || ./mt9x9.als || axi mt9x9.als trans i 0 trans j 0 trans k 0 loop (i:= 1) (<= i 9) (i:+= 3) { loop (j:= 1) (<= j 9) (j:++) { loop (k:= i) (<= k (+ i 2)) (k:++) { trans s (String (* k j)) print k 'x' j '=' (s:fill-left ' ' 2) '\t' } print '\n' } println } #!/usr/bin/axi # axc mt9x9.als && axi mt9x9.axc || ./mt9x9.als || axi mt9x9.als trans i 0 trans j 0 trans k 0 loop (i:= 1) (<= i 9) (i:+= 3) { loop (j:= 1) (<= j 9) (j:++) { loop (k:= i) (<= k (+ i 2)) (k:++) { trans s (String (* k j)) print k 'x' j '=' (s:fill-left ' ' 2) '\t' } print '\n' } println } Afnix Logo
  18. Code to Code Code to Code #!/usr/bin/rebol -q ; ./mt9x9.r

    || rebol -q mt9x9.r rebol [] foreach i [1 4 7] [ repeat j 9 [ for k i (i + 2) 1 [ prin rejoin [k "x" j "=" either k * j < 10 [" "] [""] k * j tab] ] prin crlf ] print "" ] #!/usr/bin/rebol -q ; ./mt9x9.r || rebol -q mt9x9.r rebol [] foreach i [1 4 7] [ repeat j 9 [ for k i (i + 2) 1 [ prin rejoin [k "x" j "=" either k * j < 10 [" "] [""] k * j tab] ] prin crlf ] print "" ] #!/usr/bin/boron ; ./mt9x9.b || boron mt9x9.b foreach i [1 4 7] [ foreach j [1 2 3 4 5 6 7 8 9] [ foreach K [0 1 2] [ k: add i K prin rejoin [k 'x' j '=' format [-2] mul k j '^-'] ] prin '^/' ] print "" ] #!/usr/bin/boron ; ./mt9x9.b || boron mt9x9.b foreach i [1 4 7] [ foreach j [1 2 3 4 5 6 7 8 9] [ foreach K [0 1 2] [ k: add i K prin rejoin [k 'x' j '=' format [-2] mul k j '^-'] ] prin '^/' ] print "" ] Boron Rebol
  19. Code to Code Code to Code // gcc mt9x9.c -o

    mt9x9 && ./mt9x9 || tcc -run mt9x9.c #include <stdio.h> int main(int argc, char *argv[]) { int i, j, k; for(i = 1; i <= 9; i += 3) { for(j = 1; j <= 9; j++) { for(k = i; k <= i+2; k++) printf("%dx%d=%2d\t", k, j, k*j); printf("\n"); } putchar(10); } } // gcc mt9x9.c -o mt9x9 && ./mt9x9 || tcc -run mt9x9.c #include <stdio.h> int main(int argc, char *argv[]) { int i, j, k; for(i = 1; i <= 9; i += 3) { for(j = 1; j <= 9; j++) { for(k = i; k <= i+2; k++) printf("%dx%d=%2d\t", k, j, k*j); printf("\n"); } putchar(10); } } // g++ mt9x9.cpp -o mt9x9 && ./mt9x9 #include <iostream> using namespace std; int main() { for(int i = 1; i <= 9; i += 3) { for(int j = 1; j <= 9; j++) { for(int k: {i, i+1, i+2}) printf("%dx%d=%2d\t", k, j, k*j); printf("\n"); } cout << endl; } } // g++ mt9x9.cpp -o mt9x9 && ./mt9x9 #include <iostream> using namespace std; int main() { for(int i = 1; i <= 9; i += 3) { for(int j = 1; j <= 9; j++) { for(int k: {i, i+1, i+2}) printf("%dx%d=%2d\t", k, j, k*j); printf("\n"); } cout << endl; } } C++ C
  20. Code to Code Code to Code // mcs mt9x9.cs &&

    mono mt9x9.exe using System; class Program { static void Main(string[] args) { int i, j, k; for(i = 1; i <= 9; i += 3) { for(j = 1; j <= 9; j++) { for(k = i; k <= i+2; k++) Console.Write("{0}x{1}={2}\t", k, j, (k*j).ToString().PadLeft(2)); Console.Write("\n"); } Console.WriteLine(); } } } // mcs mt9x9.cs && mono mt9x9.exe using System; class Program { static void Main(string[] args) { int i, j, k; for(i = 1; i <= 9; i += 3) { for(j = 1; j <= 9; j++) { for(k = i; k <= i+2; k++) Console.Write("{0}x{1}={2}\t", k, j, (k*j).ToString().PadLeft(2)); Console.Write("\n"); } Console.WriteLine(); } } } // ldc2 mt9x9.d && ./mt9x9 || ldc2 -run mt9x9.d import std.stdio; void main() { int i, j, k; for(i = 1; i <= 9; i += 3) { for(j = 1; j <= 9; j++) { for(k = i; k <= i+2; k++) writef("%dx%d=%2d\t", k, j, k*j); write(char(10)); } writeln(); } } // ldc2 mt9x9.d && ./mt9x9 || ldc2 -run mt9x9.d import std.stdio; void main() { int i, j, k; for(i = 1; i <= 9; i += 3) { for(j = 1; j <= 9; j++) { for(k = i; k <= i+2; k++) writef("%dx%d=%2d\t", k, j, k*j); write(char(10)); } writeln(); } } D C#
  21. Code to Code Code to Code // swiftc mt9x9.swift &&

    ./mt9x9 || swift mt9x9.swift import Foundation for i in stride(from: 1, to: 9, by: 3) { for j in 1...9 { for k in [i, i+1, i+2] { print(String(format:"%dx%d=%2d", k, j, k*j), terminator:"\t") } print() } print() } // swiftc mt9x9.swift && ./mt9x9 || swift mt9x9.swift import Foundation for i in stride(from: 1, to: 9, by: 3) { for j in 1...9 { for k in [i, i+1, i+2] { print(String(format:"%dx%d=%2d", k, j, k*j), terminator:"\t") } print() } print() } // g++ mt9x9.mm -o mt9x9 -fconstant-string-class=NSConstantString \ -I/usr/include/GNUstep -lobjc -lgnustep-base #import <Foundation/Foundation.h> #include <initializer_list> int main() { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSFileHandle *standardOutput = [NSFileHandle fileHandleWithStandardOutput]; for(NSInteger i = 1; i <= 9; i += 3) { for(NSUInteger j = 1; j <= 9; j++) { for(NSUInteger k : {i, i+1, i+2}) { [standardOutput writeData:[[NSString stringWithFormat:@"%d", k] dataUsingEncoding:NSUTF8StringEncoding]]; [standardOutput writeData:[@"x" dataUsingEncoding:NSUTF8StringEncoding]]; [standardOutput writeData:[[NSString stringWithFormat:@"%d", j] dataUsingEncoding:NSUTF8StringEncoding]]; [standardOutput writeData:[@"=" dataUsingEncoding:NSUTF8StringEncoding]]; [standardOutput writeData:[[NSString stringWithFormat:@"%2d", k*j] dataUsingEncoding:NSUTF8StringEncoding]]; [standardOutput writeData:[@"\t" dataUsingEncoding:NSUTF8StringEncoding]]; } [standardOutput writeData:[@"\n" dataUsingEncoding:NSUTF8StringEncoding]]; } [standardOutput writeData:[@"\n" dataUsingEncoding:NSUTF8StringEncoding]]; } } // g++ mt9x9.mm -o mt9x9 -fconstant-string-class=NSConstantString \ -I/usr/include/GNUstep -lobjc -lgnustep-base #import <Foundation/Foundation.h> #include <initializer_list> int main() { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSFileHandle *standardOutput = [NSFileHandle fileHandleWithStandardOutput]; for(NSInteger i = 1; i <= 9; i += 3) { for(NSUInteger j = 1; j <= 9; j++) { for(NSUInteger k : {i, i+1, i+2}) { [standardOutput writeData:[[NSString stringWithFormat:@"%d", k] dataUsingEncoding:NSUTF8StringEncoding]]; [standardOutput writeData:[@"x" dataUsingEncoding:NSUTF8StringEncoding]]; [standardOutput writeData:[[NSString stringWithFormat:@"%d", j] dataUsingEncoding:NSUTF8StringEncoding]]; [standardOutput writeData:[@"=" dataUsingEncoding:NSUTF8StringEncoding]]; [standardOutput writeData:[[NSString stringWithFormat:@"%2d", k*j] dataUsingEncoding:NSUTF8StringEncoding]]; [standardOutput writeData:[@"\t" dataUsingEncoding:NSUTF8StringEncoding]]; } [standardOutput writeData:[@"\n" dataUsingEncoding:NSUTF8StringEncoding]]; } [standardOutput writeData:[@"\n" dataUsingEncoding:NSUTF8StringEncoding]]; } } Objective-C++ Swift
  22. Code to Code Code to Code #!/usr/bin/pike // ./mt9x9.pike ||

    pike mt9x9.pike int main() { for(int i = 1; i <= 9; i += 3) { for(int j = 1; j <= 9; j++) { foreach(({i, i+1, i+2}), int k) { write(k+"x"+j+"="+sprintf("%2d\t", k*j)); } write("\n"); } write("\n"); } } #!/usr/bin/pike // ./mt9x9.pike || pike mt9x9.pike int main() { for(int i = 1; i <= 9; i += 3) { for(int j = 1; j <= 9; j++) { foreach(({i, i+1, i+2}), int k) { write(k+"x"+j+"="+sprintf("%2d\t", k*j)); } write("\n"); } write("\n"); } } // v mt9x9.v && ./mt9x9 || v run mt9x9.v fn main() { for i := 1; i <= 9; i += 3 { for j in 1..10 { for k in [i, i+1, i+2] { print('${k}x${j}=${k*j:2}\t') } print('\n') } println('') } } // v mt9x9.v && ./mt9x9 || v run mt9x9.v fn main() { for i := 1; i <= 9; i += 3 { for j in 1..10 { for k in [i, i+1, i+2] { print('${k}x${j}=${k*j:2}\t') } print('\n') } println('') } } V Pike
  23. Code to Code Code to Code // rustc mt9x9.rs &&

    ./mt9x9 fn main() { for i in (1..10).step_by(3) { for j in 1..10 { for k in &[i, i+1, i+2] { print!("{}x{}={:2}\t", k, j, k*j); } print!("\n"); } println!(); } } // rustc mt9x9.rs && ./mt9x9 fn main() { for i in (1..10).step_by(3) { for j in 1..10 { for k in &[i, i+1, i+2] { print!("{}x{}={:2}\t", k, j, k*j); } print!("\n"); } println!(); } } // zig build-exe mt9x9.zig && ./mt9x9 || zig run mt9x9.zig const std = @import("std"); pub fn main() !void { var i: u8 = 1; while (i <= 9) : (i += 3) { var j: u8 = 1; while (j <= 9) : (j += 1) { for ([_]u8{i, i+1, i+2}) |k| { std.debug.print("{d}x{d}={d: >2}\t", .{k, j, k*j}); } std.debug.print("\n", .{}); } std.debug.print("\n", .{}); } } // zig build-exe mt9x9.zig && ./mt9x9 || zig run mt9x9.zig const std = @import("std"); pub fn main() !void { var i: u8 = 1; while (i <= 9) : (i += 3) { var j: u8 = 1; while (j <= 9) : (j += 1) { for ([_]u8{i, i+1, i+2}) |k| { std.debug.print("{d}x{d}={d: >2}\t", .{k, j, k*j}); } std.debug.print("\n", .{}); } std.debug.print("\n", .{}); } } Zig Rust
  24. Code to Code Code to Code // go build mt9x9.go

    && ./mt9x9 || go run mt9x9.go package main import "fmt" func main() { for i := 1; i <= 9; i += 3 { for j := 1; j <= 9; j++ { for _, k := range []int{i, i+1, i+2} { fmt.Printf("%dx%d=%2d\t", k, j, k*j) } fmt.Printf("\n") } println() } } // go build mt9x9.go && ./mt9x9 || go run mt9x9.go package main import "fmt" func main() { for i := 1; i <= 9; i += 3 { for j := 1; j <= 9; j++ { for _, k := range []int{i, i+1, i+2} { fmt.Printf("%dx%d=%2d\t", k, j, k*j) } fmt.Printf("\n") } println() } } // odin-lang build mt9x9.odin -file && ./mt9x9.bin package mt9x9 import "core:fmt" main :: proc() { for i := 1; i <= 9; i += 3 { for j in 1..=9 { for k in ([]int{i, i+1, i+2}) { fmt.printf("%dx%d=", k, j); if k*j<10 do fmt.print(" "); fmt.printf("%d\t", k*j); } fmt.print("\n"); } fmt.println(); } } // odin-lang build mt9x9.odin -file && ./mt9x9.bin package mt9x9 import "core:fmt" main :: proc() { for i := 1; i <= 9; i += 3 { for j in 1..=9 { for k in ([]int{i, i+1, i+2}) { fmt.printf("%dx%d=", k, j); if k*j<10 do fmt.print(" "); fmt.printf("%d\t", k*j); } fmt.print("\n"); } fmt.println(); } } Odin Go
  25. Code to Code Code to Code // pawncc mt9x9.p &&

    pawnrun mt9x9.amx main() { for (new i = 1; i <= 9; i += 3) { for (new j = 1; j <= 9; j++) { for (new k = i; k <= i+2; k++) { printf "%dx%d=%2d\t", k, j, k*j } printf "\n" } print "\n" } } // pawncc mt9x9.p && pawnrun mt9x9.amx main() { for (new i = 1; i <= 9; i += 3) { for (new j = 1; j <= 9; j++) { for (new k = i; k <= i+2; k++) { printf "%dx%d=%2d\t", k, j, k*j } printf "\n" } print "\n" } } // valac mt9x9.vala && ./mt9x9 void main() { for(int i = 1; i <= 9; i += 3) { for(int j = 1; j <= 9; j++) { int[] K = {i, i+1, i+2}; foreach(int k in K) stdout.printf("%dx%d=%2d\t", k, j, k*j); print("\n"); } stdout.putc('\n'); } } // valac mt9x9.vala && ./mt9x9 void main() { for(int i = 1; i <= 9; i += 3) { for(int j = 1; j <= 9; j++) { int[] K = {i, i+1, i+2}; foreach(int k in K) stdout.printf("%dx%d=%2d\t", k, j, k*j); print("\n"); } stdout.putc('\n'); } } Vala Pawn
  26. Code to Code Code to Code // umka mt9x9.um fn

    main() { for i := 1; i <= 9; i += 3 { for j := 1; j <= 9; j++ { for k in [3]int{i, i+1, i+2} { printf("%dx%d=%2d\t", k, j, k*j) } printf("\n") } printf("\n") } } // umka mt9x9.um fn main() { for i := 1; i <= 9; i += 3 { for j := 1; j <= 9; j++ { for k in [3]int{i, i+1, i+2} { printf("%dx%d=%2d\t", k, j, k*j) } printf("\n") } printf("\n") } } #!/usr/bin/never -f # ./mt9x9.nev || never -f mt9x9.nev func main() -> int { var i = 0; for (i = 1; i <= 9; i = i+3) { var j = 0; for (j = 1; j <= 9; j = j+1) { var k = 0; for (k = i; k <= i+2; k = k+1) { prints(k + "x" + j + "="); if (k*j < 10) {prints(" ")} else {prints("")}; prints(k*j + "\t") }; prints("\n") }; prints("\n") } } #!/usr/bin/never -f # ./mt9x9.nev || never -f mt9x9.nev func main() -> int { var i = 0; for (i = 1; i <= 9; i = i+3) { var j = 0; for (j = 1; j <= 9; j = j+1) { var k = 0; for (k = i; k <= i+2; k = k+1) { prints(k + "x" + j + "="); if (k*j < 10) {prints(" ")} else {prints("")}; prints(k*j + "\t") }; prints("\n") }; prints("\n") } } Never Umka
  27. Code to Code Code to Code // adept mt9x9.adept &&

    ./mt9x9 import basics func main { for(i int = 1; i <= 9; i += 3) { for(j int = 1; j <= 9; j++) { each int in {i, i+1, i+2} { printf("%dx%d=", it, j) if it*j < 10, putchar(0x20) printf("%d\t", it*j) } place('\n') } print('') } } // adept mt9x9.adept && ./mt9x9 import basics func main { for(i int = 1; i <= 9; i += 3) { for(j int = 1; j <= 9; j++) { each int in {i, i+1, i+2} { printf("%dx%d=", it, j) if it*j < 10, putchar(0x20) printf("%d\t", it*j) } place('\n') } print('') } } Adept // surgescript mt9x9.ss object "Application" { state "main" { for(i = 1; i <= 9; i += 3) { for(j = 1; j <= 9; j++) { foreach(k in [i, i+1, i+2]) { Console.write(k+"x"+j+"="+(k*j<10?" ":"")+k*j+"\t"); } Console.write("\n"); } Console.print(""); } Application.exit(); } } // surgescript mt9x9.ss object "Application" { state "main" { for(i = 1; i <= 9; i += 3) { for(j = 1; j <= 9; j++) { foreach(k in [i, i+1, i+2]) { Console.write(k+"x"+j+"="+(k*j<10?" ":"")+k*j+"\t"); } Console.write("\n"); } Console.print(""); } Application.exit(); } } SurgeScript
  28. Code to Code Code to Code // copper mt9x9.co -o

    mt9x9 && ./mt9x9 import "std" function main var i = Int8: 1 while i <= 9 var j : Int8 (Int8: 9).each do j j ++ var s = String: "\ax\a=\a\a\t\ax\a=\a\a\t\ax\a=\a\a" var s0 = String: (i*j<10 then " " else "") var s1 = String: ((i+1)*j<10 then " " else "") var s2 = String: ((i+2)*j<10 then " " else "") Console.printFormat(s,i,j,s0,i*j,i+1,j,s1,(i+1)*j,i+2,j,s2,(i+2)*j) end Console.write("\n") i += 3 end end // copper mt9x9.co -o mt9x9 && ./mt9x9 import "std" function main var i = Int8: 1 while i <= 9 var j : Int8 (Int8: 9).each do j j ++ var s = String: "\ax\a=\a\a\t\ax\a=\a\a\t\ax\a=\a\a" var s0 = String: (i*j<10 then " " else "") var s1 = String: ((i+1)*j<10 then " " else "") var s2 = String: ((i+2)*j<10 then " " else "") Console.printFormat(s,i,j,s0,i*j,i+1,j,s1,(i+1)*j,i+2,j,s2,(i+2)*j) end Console.write("\n") i += 3 end end Copper // dcc mt9x9.jack && jackvm mt9x9.vm class Main { function void main() { var int i, j, k; let i = 1; while(i < 10) { let j = 1; while(j < 10) { let k = i; while(k < (i+3)) { do Output.printf("%dx%d=", k, j); if((k*j) < 10) { do Output.printf(" "); } do Output.printf("%d\t", k*j); let k = k + 1; } let j = j + 1; do Output.printf("\n"); } let i = i + 3; do Output.printf("\n"); } return; } } // dcc mt9x9.jack && jackvm mt9x9.vm class Main { function void main() { var int i, j, k; let i = 1; while(i < 10) { let j = 1; while(j < 10) { let k = i; while(k < (i+3)) { do Output.printf("%dx%d=", k, j); if((k*j) < 10) { do Output.printf(" "); } do Output.printf("%d\t", k*j); let k = k + 1; } let j = j + 1; do Output.printf("\n"); } let i = i + 3; do Output.printf("\n"); } return; } } Jack
  29. Code to Code Code to Code // elena64-cli mt9x9.l &&

    ./mt9x9 import extensions; public program() { for(int i := 1, i <= 9, i += 3) { for(int j := 1, j <= 9, j += 1) { for(int k := i, k <= i+2, k += 1) { console .print(k, "x", j, "=") .print((10 > k*j).iif(" ", "")) .print(k*j, $9) }; console.printLine() }; console.writeLine() }; } // elena64-cli mt9x9.l && ./mt9x9 import extensions; public program() { for(int i := 1, i <= 9, i += 3) { for(int j := 1, j <= 9, j += 1) { for(int k := i, k <= i+2, k += 1) { console .print(k, "x", j, "=") .print((10 > k*j).iif(" ", "")) .print(k*j, $9) }; console.printLine() }; console.writeLine() }; } Elena #!/usr/bin/covscript # ./mt9x9.csc || covscript mt9x9.csc foreach i in {1, 4, 7} foreach j in range(1, 10) for k = i, k <= i+2, k++ system.out.print(to_string(k)+"x"+to_string(j)+"=") system.out.print(k*j < 10 ? " " : "") system.out.print(to_string(k*j)+"\t") end system.out.print("\n") end system.out.println("") end #!/usr/bin/covscript # ./mt9x9.csc || covscript mt9x9.csc foreach i in {1, 4, 7} foreach j in range(1, 10) for k = i, k <= i+2, k++ system.out.print(to_string(k)+"x"+to_string(j)+"=") system.out.print(k*j < 10 ? " " : "") system.out.print(to_string(k*j)+"\t") end system.out.print("\n") end system.out.println("") end Covariant Script
  30. Code to Code Code to Code // as3shebang mt9x9.as3 for(var

    i:uint = 1; i <= 9; i += 3) { for(var j:uint = 1; j <= 9; j++) { var s:String = ""; for(var k:uint = i; k <= i+2; k++) s += k+"x"+j+"="+(" "+k*j).slice(-2)+"\t"; trace(s); } trace(); } // as3shebang mt9x9.as3 for(var i:uint = 1; i <= 9; i += 3) { for(var j:uint = 1; j <= 9; j++) { var s:String = ""; for(var k:uint = i; k <= i+2; k++) s += k+"x"+j+"="+(" "+k*j).slice(-2)+"\t"; trace(s); } trace(); } #!/usr/bin/gjs // ./mt9x9.js || gjs mt9x9.js for(var i = 1; i <= 9; i += 3) { for(var j = 1; j <= 9; j++) print( [i, i+1, i+2].map( k => k+'x'+j+'='+(' '+k*j).slice(-2) ).join('\t') ) print() } #!/usr/bin/gjs // ./mt9x9.js || gjs mt9x9.js for(var i = 1; i <= 9; i += 3) { for(var j = 1; j <= 9; j++) print( [i, i+1, i+2].map( k => k+'x'+j+'='+(' '+k*j).slice(-2) ).join('\t') ) print() } JavaScript ActionScript
  31. Code to Code Code to Code #!/usr/bin/deno run // deno

    compile mt9x9.ts && ./mt9x9 || // ./mt9x9.ts || deno run mt9x9.ts for(let i:number = 1; i <= 9; i += 3) { for(let j:number = 1; j <= 9; j++) console.log( [i, i+1, i+2].map( k => k+'x'+j+'='+(' '+k*j).slice(-2) ).join('\t') ) console.log() } #!/usr/bin/deno run // deno compile mt9x9.ts && ./mt9x9 || // ./mt9x9.ts || deno run mt9x9.ts for(let i:number = 1; i <= 9; i += 3) { for(let j:number = 1; j <= 9; j++) console.log( [i, i+1, i+2].map( k => k+'x'+j+'='+(' '+k*j).slice(-2) ).join('\t') ) console.log() } #!/usr/bin/bsh // ./mt9x9.bsh || bsh mt9x9.bsh for(i = 1; i <= 9; i += 3) { for(j = 1; j <= 9; j++) { for(k: new int[]{i, i+1, i+2}) System.out.printf("%dx%d=%2d\t", k, j, k*j); System.out.printf("\n"); } System.out.println(); } #!/usr/bin/bsh // ./mt9x9.bsh || bsh mt9x9.bsh for(i = 1; i <= 9; i += 3) { for(j = 1; j <= 9; j++) { for(k: new int[]{i, i+1, i+2}) System.out.printf("%dx%d=%2d\t", k, j, k*j); System.out.printf("\n"); } System.out.println(); } BeanShell TypeScript
  32. Code to Code Code to Code // javac mt9x9.java &&

    java mt9x9 public class mt9x9 { public static void main(String args[]) { for(int i = 1; i <= 9; i += 3) { for(int j = 1; j <= 9; j++) { for(int k: new int[]{i, i+1, i+2}) System.out.printf("%dx%d=%2d\t", k, j, k*j); System.out.printf("\n"); } System.out.println(); } } } // javac mt9x9.java && java mt9x9 public class mt9x9 { public static void main(String args[]) { for(int i = 1; i <= 9; i += 3) { for(int j = 1; j <= 9; j++) { for(int k: new int[]{i, i+1, i+2}) System.out.printf("%dx%d=%2d\t", k, j, k*j); System.out.printf("\n"); } System.out.println(); } } } #!/usr/bin/fan // ./mt9x9.fan || fan mt9x9.fan class mt9x9 { static Void main() { for(i := 1; i < 9; i += 3) { for(j := 1; j <= 9; j++) { [i, i+1, i+2].each |Int k| { Env.cur.out.print(k.toStr+"x"+j.toStr+"="+ (k*j).toStr.padl(2,' ')+"\t") } Env.cur.out.printLine() } echo() } } } #!/usr/bin/fan // ./mt9x9.fan || fan mt9x9.fan class mt9x9 { static Void main() { for(i := 1; i < 9; i += 3) { for(j := 1; j <= 9; j++) { [i, i+1, i+2].each |Int k| { Env.cur.out.print(k.toStr+"x"+j.toStr+"="+ (k*j).toStr.padl(2,' ')+"\t") } Env.cur.out.printLine() } echo() } } } Fantom Java
  33. Code to Code Code to Code // scalac mt9x9.scala &&

    scala mt9x9 object mt9x9 { def main(args: Array[String]) = { for (i <- 1 to 9 by 3) { for (j <- 1 to 9) { List(i, i+1, i+2).foreach { k => print(k+"x"+j+"="+f"${k*j}%2d"+"\t") } println() } println() } } } // scalac mt9x9.scala && scala mt9x9 object mt9x9 { def main(args: Array[String]) = { for (i <- 1 to 9 by 3) { for (j <- 1 to 9) { List(i, i+1, i+2).foreach { k => print(k+"x"+j+"="+f"${k*j}%2d"+"\t") } println() } println() } } } // kotlinc-native -o mt9x9 mt9x9.kt && ./mt9x9.kexe fun main() { for (i in 1..9 step 3) { for (j in 1..9) { (i..i+2).forEach { print("${it}x${j}=") print((it*j).toString().padStart(2) + "\t") } print("\n") } println() } } // kotlinc-native -o mt9x9 mt9x9.kt && ./mt9x9.kexe fun main() { for (i in 1..9 step 3) { for (j in 1..9) { (i..i+2).forEach { print("${it}x${j}=") print((it*j).toString().padStart(2) + "\t") } print("\n") } println() } } Kotlin Scala
  34. Code to Code Code to Code #!/usr/bin/groovy // ./mt9x9.groovy ||

    groovy mt9x9.groovy for(i in (1..9).step(3)) { for(j in 1..9) { for(k in [i, i+1, i+2]) { printf("%dx%d=%2d\t", k, j, k*j) } println() } println "" } #!/usr/bin/groovy // ./mt9x9.groovy || groovy mt9x9.groovy for(i in (1..9).step(3)) { for(j in 1..9) { for(k in [i, i+1, i+2]) { printf("%dx%d=%2d\t", k, j, k*j) } println() } println "" } // ceylon compile --src . mt9x9.ceylon && ceylon run default shared void run() { for(i in (1..9).by(3)) { for(j in 1..9) { for(k in [i, i+1, i+2]) { process.write("``k``x``j``="); process.write("``k*j<10 then " " else ""````k*j``\t"); } print(""); } print(""); } } // ceylon compile --src . mt9x9.ceylon && ceylon run default shared void run() { for(i in (1..9).by(3)) { for(j in 1..9) { for(k in [i, i+1, i+2]) { process.write("``k``x``j``="); process.write("``k*j<10 then " " else ""````k*j``\t"); } print(""); } print(""); } } Ceylon Groovy
  35. Code to Code Code to Code ## aviator mt9x9.av for

    i in range(1, 9, 3) { for j in range(1, 10) { for k in tuple(i, i+1, i+2) { print(k+"x"+j+"="+(k*j<10?" ":"")+k*j+"\t"); } println(); } if i < 7 {p();} } return ""; ## aviator mt9x9.av for i in range(1, 9, 3) { for j in range(1, 10) { for k in tuple(i, i+1, i+2) { print(k+"x"+j+"="+(k*j<10?" ":"")+k*j+"\t"); } println(); } if i < 7 {p();} } return ""; AviatorScript // x10c mt9x9.x10 && x10 mt9x9 import x10.io.Console; class mt9x9 { public static def main(args:Rail[String]):void { for (var i:Int = 1n; i <= 9n; i += 3n) { for (j in 1..9) { for (k in [i, i+1n, i+2n]) { Console.OUT.printf("%dx%d=%2d\t", k, j, k*j); } Console.OUT.print("\n"); } Console.OUT.println(); } } } // x10c mt9x9.x10 && x10 mt9x9 import x10.io.Console; class mt9x9 { public static def main(args:Rail[String]):void { for (var i:Int = 1n; i <= 9n; i += 3n) { for (j in 1..9) { for (k in [i, i+1n, i+2n]) { Console.OUT.printf("%dx%d=%2d\t", k, j, k*j); } Console.OUT.print("\n"); } Console.OUT.println(); } } } X10
  36. Code to Code Code to Code #!/usr/bin/perl # ./mt9x9.pl ||

    perl mt9x9.pl for (my $i = 1; $i <= 9; $i += 3) { for (my $j = 1; $j <= 9; $j++) { foreach my $k ($i..$i+2) { printf("%dx%d=%2d\t", $k, $j, $k*$j); } printf("\n"); } print "\n"; } #!/usr/bin/perl # ./mt9x9.pl || perl mt9x9.pl for (my $i = 1; $i <= 9; $i += 3) { for (my $j = 1; $j <= 9; $j++) { foreach my $k ($i..$i+2) { printf("%dx%d=%2d\t", $k, $j, $k*$j); } printf("\n"); } print "\n"; } #!/usr/bin/rakudo # ./mt9x9.raku || rakudo mt9x9.raku for 1,4,7 -> $i { for 1..9 -> $j { for $i, $i+1, $i+2 -> $k { printf "%dx%d=%2d\t", $k, $j, $k*$j; } print "\n"; } say ""; } #!/usr/bin/rakudo # ./mt9x9.raku || rakudo mt9x9.raku for 1,4,7 -> $i { for 1..9 -> $j { for $i, $i+1, $i+2 -> $k { printf "%dx%d=%2d\t", $k, $j, $k*$j; } print "\n"; } say ""; } Raku Perl
  37. Code to Code Code to Code #!/usr/bin/odo # ./mt9x9.odo ||

    odo mt9x9.odo foreach i : [1, 4, 7] { forange j : 1, 10 { forange k : i, i+3 { write(k, "x", j, "=") if k*j < 10 {write(" ")} write(k*j, "\t") } write("\n") } writeln() } #!/usr/bin/odo # ./mt9x9.odo || odo mt9x9.odo foreach i : [1, 4, 7] { forange j : 1, 10 { forange k : i, i+3 { write(k, "x", j, "=") if k*j < 10 {write(" ")} write(k*j, "\t") } write("\n") } writeln() } #!/usr/bin/aime # ./mt9x9.aime || aime mt9x9.aime integer i, j, k; for (,i in list(1, 4, 7)) { j = 1; while (j <= 9) { for (,k in list(i, i+1, i+2)) { o_(k, "x", j, "="); o_winteger(2, k*j); o_text("\t"); } o_text("\n"); j += 1; } o_newline(); } #!/usr/bin/aime # ./mt9x9.aime || aime mt9x9.aime integer i, j, k; for (,i in list(1, 4, 7)) { j = 1; while (j <= 9) { for (,k in list(i, i+1, i+2)) { o_(k, "x", j, "="); o_winteger(2, k*j); o_text("\t"); } o_text("\n"); j += 1; } o_newline(); } Aime Odo
  38. Code to Code Code to Code #!/usr/bin/slsh % ./mt9x9.sl ||

    slsh mt9x9.sl variable i, j, k; foreach i ([1:9:3]) { foreach j ([1:9]) { foreach k ([i, i+1, i+2]) { printf("%dx%d=%2d\t", k, j, k*j); } fprintf(stdout, "\n"); } fputs("\n", stdout); } #!/usr/bin/slsh % ./mt9x9.sl || slsh mt9x9.sl variable i, j, k; foreach i ([1:9:3]) { foreach j ([1:9]) { foreach k ([i, i+1, i+2]) { printf("%dx%d=%2d\t", k, j, k*j); } fprintf(stdout, "\n"); } fputs("\n", stdout); } #!/usr/bin/lua -- ./mt9x9.lua || lua mt9x9.lua for i = 1,9,3 do for j = 1,9 do for k = i,i+2 do io.write(string.format('%dx%d=%2d\t', k, j, k*j)) end io.write('\n') end print() end #!/usr/bin/lua -- ./mt9x9.lua || lua mt9x9.lua for i = 1,9,3 do for j = 1,9 do for k = i,i+2 do io.write(string.format('%dx%d=%2d\t', k, j, k*j)) end io.write('\n') end print() end Lua S-Lang
  39. Code to Code Code to Code #!/usr/bin/tclsh # ./mt9x9.tcl ||

    tclsh mt9x9.tcl for {set i 1} {$i <= 9} {incr i 3} { for {set j 1} {$j <= 9} {incr j} { for {set k $i} {$k <= $i+2} {incr k} { puts -nonewline [ format "%dx%d=%2d\t" $k $j [expr {$k*$j}] ] } puts -nonewline "\n" } puts "" } #!/usr/bin/tclsh # ./mt9x9.tcl || tclsh mt9x9.tcl for {set i 1} {$i <= 9} {incr i 3} { for {set j 1} {$j <= 9} {incr j} { for {set k $i} {$k <= $i+2} {incr k} { puts -nonewline [ format "%dx%d=%2d\t" $k $j [expr {$k*$j}] ] } puts -nonewline "\n" } puts "" } #!/usr/bin/rexx -- ./mt9x9.rex || rexx mt9x9.rex loop i = 1 to 9 by 3 loop j = 1 to 9 loop k = i to i+2 .output~charout(k"x"j"="format(k*j, 2)"09"x) end .output~charout("0a"x) end say end #!/usr/bin/rexx -- ./mt9x9.rex || rexx mt9x9.rex loop i = 1 to 9 by 3 loop j = 1 to 9 loop k = i to i+2 .output~charout(k"x"j"="format(k*j, 2)"09"x) end .output~charout("0a"x) end say end REXX TCL
  40. Code to Code Code to Code #!/usr/bin/hhvm // ./mt9x9.hack ||

    hhvm mt9x9.hack <<__EntryPoint>> function main(): void { for ($i = 1; $i <= 9; $i += 3) { for ($j = 1; $j <= 9; $j++) { foreach (vec[$i, $i+1, $i+2] as $k) { printf("%dx%d=%2d\t", $k, $j, $k*$j); } print("\n"); } echo "\n"; } } #!/usr/bin/hhvm // ./mt9x9.hack || hhvm mt9x9.hack <<__EntryPoint>> function main(): void { for ($i = 1; $i <= 9; $i += 3) { for ($j = 1; $j <= 9; $j++) { foreach (vec[$i, $i+1, $i+2] as $k) { printf("%dx%d=%2d\t", $k, $j, $k*$j); } print("\n"); } echo "\n"; } } #!/usr/bin/php <?php // ./mt9x9.php || php mt9x9.php for ($i = 1; $i <= 9; $i += 3) { for ($j = 1; $j <= 9; $j++) { foreach (array($i, $i+1, $i+2) as $k) { printf("%dx%d=%2d\t", $k, $j, $k*$j); } print("\n"); } echo "\n"; } ?> #!/usr/bin/php <?php // ./mt9x9.php || php mt9x9.php for ($i = 1; $i <= 9; $i += 3) { for ($j = 1; $j <= 9; $j++) { foreach (array($i, $i+1, $i+2) as $k) { printf("%dx%d=%2d\t", $k, $j, $k*$j); } print("\n"); } echo "\n"; } ?> PHP Hack
  41. Code to Code Code to Code #!/usr/bin/bash # ./mt9x9.sh ||

    bash mt9x9.sh for i in {1..9..3}; do for (( j = 1; j <= 9; j++ )); do for k in $i $((i+1)) $((i+2)); do printf '%dx%d=%2d\t' $k $j $((k*j)) done printf '\n' done echo done #!/usr/bin/bash # ./mt9x9.sh || bash mt9x9.sh for i in {1..9..3}; do for (( j = 1; j <= 9; j++ )); do for k in $i $((i+1)) $((i+2)); do printf '%dx%d=%2d\t' $k $j $((k*j)) done printf '\n' done echo done #!/usr/bin/fish # ./mt9x9.fish || fish mt9x9.fish for i in (seq 1 3 9) for j in (seq 9) for k in $i (math $i + 1) (math $i + 2) printf %dx%d=%2d\t $k $j (math "$k * $j") end printf \n end echo end #!/usr/bin/fish # ./mt9x9.fish || fish mt9x9.fish for i in (seq 1 3 9) for j in (seq 9) for k in $i (math $i + 1) (math $i + 2) printf %dx%d=%2d\t $k $j (math "$k * $j") end printf \n end echo end Fish BASH
  42. Code to Code Code to Code #!/usr/bin/elvish # ./mt9x9.elv ||

    elvish mt9x9.elv for i [(range 1 10 &step=3)] { for j [(range 1 10)] { for k [$i (+ $i 1) (+ $i 2)] { printf '%dx%d=%2d\t' $k $j (* $k $j) } print "\n" } echo } #!/usr/bin/elvish # ./mt9x9.elv || elvish mt9x9.elv for i [(range 1 10 &step=3)] { for j [(range 1 10)] { for k [$i (+ $i 1) (+ $i 2)] { printf '%dx%d=%2d\t' $k $j (* $k $j) } print "\n" } echo } #!/usr/bin/ysh # ./mt9x9.ysh || ysh mt9x9.ysh for i in (1, 4, 7) { for j in {1..9} { for k in $i $[i+1] $[i+2] { printf '%dx%d=%2d\t' $k $j $[k*j] } write } echo } #!/usr/bin/ysh # ./mt9x9.ysh || ysh mt9x9.ysh for i in (1, 4, 7) { for j in {1..9} { for k in $i $[i+1] $[i+2] { printf '%dx%d=%2d\t' $k $j $[k*j] } write } echo } YSH Elvish
  43. Code to Code Code to Code #!/usr/bin/abs // ./mt9x9.abs ||

    abs mt9x9.abs for i in [1, 4, 7] { for j in 1..9 { s = "" for k in [i, i+1, i+2] { s = s + fmt("%sx%s=%2s\t", k, j, k*j) } echo(s) } echo() } #!/usr/bin/abs // ./mt9x9.abs || abs mt9x9.abs for i in [1, 4, 7] { for j in 1..9 { s = "" for k in [i, i+1, i+2] { s = s + fmt("%sx%s=%2s\t", k, j, k*j) } echo(s) } echo() } #!/usr/bin/ngs # ./mt9x9.ngs || ngs mt9x9.ngs for(i; 3) { for(j = 1; j <= 9; j += 1) { [i*3+1, i*3+2, i*3+3].each(F(k) { write("${k}x${j}=${if k*j<10 ' ' ''}${k*j}\t") }) write('\n') } echo('') } #!/usr/bin/ngs # ./mt9x9.ngs || ngs mt9x9.ngs for(i; 3) { for(j = 1; j <= 9; j += 1) { [i*3+1, i*3+2, i*3+3].each(F(k) { write("${k}x${j}=${if k*j<10 ' ' ''}${k*j}\t") }) write('\n') } echo('') } NGS ABS
  44. Code to Code Code to Code // chai mt9x9.chai for(var

    i = 1; i <= 9; i += 3) { for(var j = 1; j <= 9; ++j) { for(k: [i, i+1, i+2]) { puts("${k}x${j}="); if(k*j < 10) {puts(" ");} puts("${k*j}\t"); } puts("\n"); } print(""); } // chai mt9x9.chai for(var i = 1; i <= 9; i += 3) { for(var j = 1; j <= 9; ++j) { for(k: [i, i+1, i+2]) { puts("${k}x${j}="); if(k*j < 10) {puts(" ");} puts("${k*j}\t"); } puts("\n"); } print(""); } #!/usr/bin/tcsh -f # ./mt9x9.csh || tcsh -f mt9x9.csh foreach i (1 4 7) set j = 1 while ($j <= 9) foreach K (0 1 2) @ k = $i + $K echo -n "$k"x"$j"= @ s = $k * $j if ($s < 10) echo -n " " echo -n "$s\t" end echo -n "\n" @ j++ end echo end #!/usr/bin/tcsh -f # ./mt9x9.csh || tcsh -f mt9x9.csh foreach i (1 4 7) set j = 1 while ($j <= 9) foreach K (0 1 2) @ k = $i + $K echo -n "$k"x"$j"= @ s = $k * $j if ($s < 10) echo -n " " echo -n "$s\t" end echo -n "\n" @ j++ end echo end CSH ChaiScript
  45. Code to Code Code to Code #!/usr/bin/oh # ./mt9x9.oh ||

    oh mt9x9.oh for (seq 3) (method (I) { define i (math "$I * 3 + 1") for (seq 9) (method (J) { define j (math "$J + 1") for (seq 3) (method (K) { define k (math "$K + $i") printf %dx%d=%2d\t $k $j (math "$k * $j") }) printf \n }) echo }) #!/usr/bin/oh # ./mt9x9.oh || oh mt9x9.oh for (seq 3) (method (I) { define i (math "$I * 3 + 1") for (seq 9) (method (J) { define j (math "$J + 1") for (seq 3) (method (K) { define k (math "$K + $i") printf %dx%d=%2d\t $k $j (math "$k * $j") }) printf \n }) echo }) #!/usr/bin/murex # ./mt9x9.mx || murex mt9x9.mx for: (i = 1; i <= 9; i = i + 3) { a: [1..9] -> foreach: j { a: [$i, ${= i+1}, ${= i+2}] -> foreach: k { (${= k}x${= j}=) if: {= $k*$j < 10} {( )} (${= $k*$j})\t } ()\n } out: } #!/usr/bin/murex # ./mt9x9.mx || murex mt9x9.mx for: (i = 1; i <= 9; i = i + 3) { a: [1..9] -> foreach: j { a: [$i, ${= i+1}, ${= i+2}] -> foreach: k { (${= k}x${= j}=) if: {= $k*$j < 10} {( )} (${= $k*$j})\t } ()\n } out: } Murex Oh
  46. Code to Code Code to Code #!/usr/bin/pwsh # ./mt9x9.ps1 ||

    pwsh mt9x9.ps1 For ($i = 1; $i -le 9; $i += 3) { ForEach ($j in 1..9) { ForEach ($k in $i, ($i+1), ($i+2)) { Write-Host -NoNewline ("{0}x{1}={2,2}`t" -f $k, $j, ($k*$j)) } Write-Host } "" } #!/usr/bin/pwsh # ./mt9x9.ps1 || pwsh mt9x9.ps1 For ($i = 1; $i -le 9; $i += 3) { ForEach ($j in 1..9) { ForEach ($k in $i, ($i+1), ($i+2)) { Write-Host -NoNewline ("{0}x{1}={2,2}`t" -f $k, $j, ($k*$j)) } Write-Host } "" } @echo off rem wine cmd /c mt9x9.bat setlocal enabledelayedexpansion for /l %%i in (1,3,9) do ( for /l %%j in (1,1,9) do ( for /l %%K in (0,1,2) do ( set /a k=%%i+%%K set /a s=!k!*%%j <nul set/p"=!k!x%%j=" if !s! lss 10 (<nul set/p"= ") <nul set/p"=!s! " ⇥ ) echo. ) echo. ) endlocal @echo off rem wine cmd /c mt9x9.bat setlocal enabledelayedexpansion for /l %%i in (1,3,9) do ( for /l %%j in (1,1,9) do ( for /l %%K in (0,1,2) do ( set /a k=%%i+%%K set /a s=!k!*%%j <nul set/p"=!k!x%%j=" if !s! lss 10 (<nul set/p"= ") <nul set/p"=!s! " ⇥ ) echo. ) echo. ) endlocal Batch PowerShell
  47. Code to Code Code to Code #!/usr/bin/awk -f # ./mt9x9.awk

    || awk -f mt9x9.awk BEGIN { for(i = 1; i <= 9; i += 3) { for(j = 1; j <= 9; j++) { for(k = i; k <= i+2; k++) printf("%dx%d=%2d\t", k, j, k*j) printf "\n" } print } } #!/usr/bin/awk -f # ./mt9x9.awk || awk -f mt9x9.awk BEGIN { for(i = 1; i <= 9; i += 3) { for(j = 1; j <= 9; j++) { for(k = i; k <= i+2; k++) printf("%dx%d=%2d\t", k, j, k*j) printf "\n" } print } } AWK # mlr -n put -f mt9x9.mlr begin { for (int i = 1; i <= 9; i += 3) { for (int j = 1; j <= 9; j += 1) { for (int k = i; k <= i+2; k += 1) { printn fmtnum(k, "%dx").fmtnum(j, "%d=") printn fmtnum(j*k, "%2d\t"); } printn "\n"; } print; } } # mlr -n put -f mt9x9.mlr begin { for (int i = 1; i <= 9; i += 3) { for (int j = 1; j <= 9; j += 1) { for (int k = i; k <= i+2; k += 1) { printn fmtnum(k, "%dx").fmtnum(j, "%d=") printn fmtnum(j*k, "%2d\t"); } printn "\n"; } print; } } Miller
  48. Code to Code Code to Code #!/usr/bin/nickle # nickle mt9x9.5c

    int i, j, k; for(i = 1; i <= 9; i += 3) { for(j = 1; j <= 9; j++) { for(k = i; k <= i+2; k++) printf("%dx%d=%2d\t", k, j, k*j); putchar(10); } printf("\n"); } exit(0); #!/usr/bin/nickle # nickle mt9x9.5c int i, j, k; for(i = 1; i <= 9; i += 3) { for(j = 1; j <= 9; j++) { for(k = i; k <= i+2; k++) printf("%dx%d=%2d\t", k, j, k*j); putchar(10); } printf("\n"); } exit(0); Nickle #!/usr/bin/stap // ./mt9x9.stp || stap mt9x9.stp probe oneshot { for(i = 1; i <= 9; i += 3) { for(j = 1; j <= 9; j++) { for(k = i; k <= i+2; k++) printf("%dx%d=%2d\t", k, j, k*j) print("\n") } println() } } #!/usr/bin/stap // ./mt9x9.stp || stap mt9x9.stp probe oneshot { for(i = 1; i <= 9; i += 3) { for(j = 1; j <= 9; j++) { for(k = i; k <= i+2; k++) printf("%dx%d=%2d\t", k, j, k*j) print("\n") } println() } } SystemTap
  49. Code to Code Code to Code #!/usr/bin/bs # ./mt9x9.bs ||

    bs mt9x9.bs for i = 1, i <= 9, i = i+3 for j = 1, j <= 9, ++j s = "" for k = i, k <= i+2, ++k s = s_k_"x"_j_"="_("", " ")[k*j < 10]_k*j_"\t" next put = s next put = "" next run exit #!/usr/bin/bs # ./mt9x9.bs || bs mt9x9.bs for i = 1, i <= 9, i = i+3 for j = 1, j <= 9, ++j s = "" for k = i, k <= i+2, ++k s = s_k_"x"_j_"="_("", " ")[k*j < 10]_k*j_"\t" next put = s next put = "" next run exit # objeckc -src mt9x9.obs -dest mt9x9.obe && objeckr mt9x9.obe class mt9x9 { function : Main(args : String[]) ~ Nil { for(i := 1; i <= 9; i += 3;) { for(j := 1; j <= 9; j += 1;) { for(k := i; k <= i+2; k++;) { IO.Console->Print(k)->Print('x')->Print(j)->Print('='); if(k*j<10) {IO.Console->Print(' ');}; IO.Console->Print(k*j)->Print('\t'); }; '\n'->Print(); }; ""->PrintLine(); }; } } # objeckc -src mt9x9.obs -dest mt9x9.obe && objeckr mt9x9.obe class mt9x9 { function : Main(args : String[]) ~ Nil { for(i := 1; i <= 9; i += 3;) { for(j := 1; j <= 9; j += 1;) { for(k := i; k <= i+2; k++;) { IO.Console->Print(k)->Print('x')->Print(j)->Print('='); if(k*j<10) {IO.Console->Print(' ');}; IO.Console->Print(k*j)->Print('\t'); }; '\n'->Print(); }; ""->PrintLine(); }; } } Objeck BS
  50. Code to Code Code to Code // slogan -e mt9x9.sn

    for (i = 1; i <= 9; i+3) { for (j = 1; j <= 9; j+1) { for (k = i; k <= i+2; k+1) show(k, "x", j, "=", if (k*j < 10) " " else "", k*j, "\t") newline() } showln() } // slogan -e mt9x9.sn for (i = 1; i <= 9; i+3) { for (j = 1; j <= 9; j+1) { for (k = i; k <= i+2; k+1) show(k, "x", j, "=", if (k*j < 10) " " else "", k*j, "\t") newline() } showln() } // chuck --silent mt9x9.ck for (1 => int i; i <= 9; 3 +=> i) { for (1 => int j; j <= 9; j++) { for (i => int k; k <= i+2; k++) { chout <= k <= "x" <= j <= "="; if (k*j < 10) chout <= " "; chout <= k*j <= "\t"; } chout <= "\n"; } chout <= IO.nl(); } // chuck --silent mt9x9.ck for (1 => int i; i <= 9; 3 +=> i) { for (1 => int j; j <= 9; j++) { for (i => int k; k <= i+2; k++) { chout <= k <= "x" <= j <= "="; if (k*j < 10) chout <= " "; chout <= k*j <= "\t"; } chout <= "\n"; } chout <= IO.nl(); } Chuck Slogan
  51. Code to Code Code to Code % picat mt9x9.pi main

    => foreach(I in 1..9, I mod 3 == 1) foreach(J in 1..9) foreach(K in [I, I+1, I+2]) writef("%dx%d=%2d\t", K, J, K*J) end, writef("\n") end, print("\n") end. % picat mt9x9.pi main => foreach(I in 1..9, I mod 3 == 1) foreach(J in 1..9) foreach(K in [I, I+1, I+2]) writef("%dx%d=%2d\t", K, J, K*J) end, writef("\n") end, print("\n") end. // ./mt9x9.zkl || zkl mt9x9.zkl foreach i in ([1..9, 3]) { foreach j in (Utils.range(1, 9)) { foreach k in (L(i, i+1, i+2)) { print(k, "x", j, "=", "%2d".fmt(k*j), "\t"); } print("\n"); } println(); } // ./mt9x9.zkl || zkl mt9x9.zkl foreach i in ([1..9, 3]) { foreach j in (Utils.range(1, 9)) { foreach k in (L(i, i+1, i+2)) { print(k, "x", j, "=", "%2d".fmt(k*j), "\t"); } print("\n"); } println(); } ZKL Picat
  52. Code to Code Code to Code // haxe --main Mt9x9

    --interp class Mt9x9 { static function main() { for (i in [1, 4, 7]) { for (j in 1...10) { for (k in [i, i+1, i+2]) { Sys.print(k+'x'+j+'='+(k*j<10?' ':'')+k*j+'\t'); } Sys.print('\n'); } Sys.println(''); } } } // haxe --main Mt9x9 --interp class Mt9x9 { static function main() { for (i in [1, 4, 7]) { for (j in 1...10) { for (k in [i, i+1, i+2]) { Sys.print(k+'x'+j+'='+(k*j<10?' ':'')+k*j+'\t'); } Sys.print('\n'); } Sys.println(''); } } } // ponyc -b mt9x9 && ./mt9x9 use "collections" use "format" actor Main new create(env: Env) => for i in Range[U8](1, 10, 3) do for j in Range[U8](1, 10) do for k in [i; i+1; i+2].values() do env.out.write(k.string() + "x" + j.string() + "=" + Format.int[U8](k*j where width=2) + "\t") end env.out.write("\n") end env.out.print("") end // ponyc -b mt9x9 && ./mt9x9 use "collections" use "format" actor Main new create(env: Env) => for i in Range[U8](1, 10, 3) do for j in Range[U8](1, 10) do for k in [i; i+1; i+2].values() do env.out.write(k.string() + "x" + j.string() + "=" + Format.int[U8](k*j where width=2) + "\t") end env.out.write("\n") end env.out.print("") end Pony Haxe
  53. Code to Code Code to Code # colm mt9x9.lm &&

    ./mt9x9 i: int = 1 while (i <= 9) { j: int = 1 while (j <= 9) { k: int = i while (k <= i+2) { print(k, 'x', j, '=') if (k*j < 10) print(' ') print(k*j, '\t') k = k + 1 } print('\n') j = j + 1 } print('\n') i = i + 3 } # colm mt9x9.lm && ./mt9x9 i: int = 1 while (i <= 9) { j: int = 1 while (j <= 9) { k: int = i while (k <= i+2) { print(k, 'x', j, '=') if (k*j < 10) print(' ') print(k*j, '\t') k = k + 1 } print('\n') j = j + 1 } print('\n') i = i + 3 } // nekoc mt9x9.neko && neko mt9x9.n var sprintf = $loader.loadprim("std@sprintf", 2); var i = 1; while i <= 9 { var j = 1; while j <= 9 { var k = i; while k <= i+2 { $print(k, "x", j, "=", sprintf("%2d", k*j), "\t"); k += 1; } $print("\n"); j += 1; } $print("\n"); i += 3; } // nekoc mt9x9.neko && neko mt9x9.n var sprintf = $loader.loadprim("std@sprintf", 2); var i = 1; while i <= 9 { var j = 1; while j <= 9 { var k = i; while k <= i+2 { $print(k, "x", j, "=", sprintf("%2d", k*j), "\t"); k += 1; } $print("\n"); j += 1; } $print("\n"); i += 3; } Neko Colm
  54. Code to Code Code to Code #!/usr/bin/nit # nitc mt9x9.nit

    && ./mt9x9 || ./mt9x9.nit || nit mt9x9.nit for i in [1..10[.step(3) do for j in [1..9] do for k in [i, i+1, i+2] do printn "{k}x{j}=" if k*j < 10 then printn " " end printn "{k*j}\t" end printn "\n" end print "" end #!/usr/bin/nit # nitc mt9x9.nit && ./mt9x9 || ./mt9x9.nit || nit mt9x9.nit for i in [1..10[.step(3) do for j in [1..9] do for k in [i, i+1, i+2] do printn "{k}x{j}=" if k*j < 10 then printn " " end printn "{k*j}\t" end printn "\n" end print "" end % ozc -c mt9x9.oz && ozengine mt9x9.ozf functor import System define for I in 1..9;3 do for J in 1..9 do for K in [I I+1 I+2] do {System.printInfo K#"x"#J#"="} if K*J < 10 then {System.printInfo " "} end {System.printInfo K*J#"\t"} end {System.printInfo "\n"} end {System.showInfo ""} end end % ozc -c mt9x9.oz && ozengine mt9x9.ozf functor import System define for I in 1..9;3 do for J in 1..9 do for K in [I I+1 I+2] do {System.printInfo K#"x"#J#"="} if K*J < 10 then {System.printInfo " "} end {System.printInfo K*J#"\t"} end {System.printInfo "\n"} end {System.showInfo ""} end end Oz Nit
  55. Code to Code Code to Code #!/usr/bin/guile -s !# ;

    ./mt9x9.scm || guile mt9x9.scm (use-modules (ice-9 format)) (for-each (lambda (i) (for-each (lambda (j) (for-each (lambda (k) (format #t "~dx~d=~2d~c" k j (* k j) #\tab)) (list i (+ i 1) (+ i 2))) (display #\newline)) (map 1+ (iota 9))) (newline)) '(1 4 7)) #!/usr/bin/guile -s !# ; ./mt9x9.scm || guile mt9x9.scm (use-modules (ice-9 format)) (for-each (lambda (i) (for-each (lambda (j) (for-each (lambda (k) (format #t "~dx~d=~2d~c" k j (* k j) #\tab)) (list i (+ i 1) (+ i 2))) (display #\newline)) (map 1+ (iota 9))) (newline)) '(1 4 7)) #!/usr/bin/gcl -f ; ./mt9x9.lisp || gcl -f mt9x9.lisp (dolist (i '(1 4 7)) (dolist (j '(1 2 3 4 5 6 7 8 9)) (dolist (k (list i (+ i 1) (+ i 2))) (format t "~Dx~D=~2D ~@T" k j (* k j)) ) (format t "~%") ) (terpri) ) #!/usr/bin/gcl -f ; ./mt9x9.lisp || gcl -f mt9x9.lisp (dolist (i '(1 4 7)) (dolist (j '(1 2 3 4 5 6 7 8 9)) (dolist (k (list i (+ i 1) (+ i 2))) (format t "~Dx~D=~2D ~@T" k j (* k j)) ) (format t "~%") ) (terpri) ) CommonLisp Scheme
  56. Code to Code Code to Code #!/usr/bin/janet # ./mt9x9.janet ||

    janet mt9x9.janet (loop [i :range [1 9] :when (zero? (% (- i 1) 3))] (for j 1 10 (each k [i (+ i 1) (+ i 2)] (prin k "x" j "=" (string/format "%2d" (* k j)) "\t") ) (print) ) (print) ) #!/usr/bin/janet # ./mt9x9.janet || janet mt9x9.janet (loop [i :range [1 9] :when (zero? (% (- i 1) 3))] (for j 1 10 (each k [i (+ i 1) (+ i 2)] (prin k "x" j "=" (string/format "%2d" (* k j)) "\t") ) (print) ) (print) ) #!/usr/bin/clojure ;; ./mt9x9.clj || clojure mt9x9.clj (doseq [i (range 1 10 3) j (range 1 10) k [i (+ i 1) (+ i 2)]] (printf "%dx%d=%2d" k j (* k j)) (print (if (not= k (+ i 2)) "\t" (if (= j 9) "\n\n" "\n"))) ) #!/usr/bin/clojure ;; ./mt9x9.clj || clojure mt9x9.clj (doseq [i (range 1 10 3) j (range 1 10) k [i (+ i 1) (+ i 2)]] (printf "%dx%d=%2d" k j (* k j)) (print (if (not= k (+ i 2)) "\t" (if (= j 9) "\n\n" "\n"))) ) Clojure Janet
  57. Code to Code Code to Code #!/usr/bin/scsh -s !# ;

    ./mt9x9.scsh || scsh -s mt9x9.scsh (for-each (lambda (i) (for-each (lambda (j) (for-each (lambda (k) (format #t "~Dx~D=" k j) (if (< (* k j) 10) (format #t " ")) (format #t "~D~A" (* k j) #\tab)) (list i (+ i 1) (+ i 2))) (display #\newline)) (map (lambda (x) (+ 1 x)) (iota 9))) (newline)) '(1 4 7)) #!/usr/bin/scsh -s !# ; ./mt9x9.scsh || scsh -s mt9x9.scsh (for-each (lambda (i) (for-each (lambda (j) (for-each (lambda (k) (format #t "~Dx~D=" k j) (if (< (* k j) 10) (format #t " ")) (format #t "~D~A" (* k j) #\tab)) (list i (+ i 1) (+ i 2))) (display #\newline)) (map (lambda (x) (+ 1 x)) (iota 9))) (newline)) '(1 4 7)) #!/usr/bin/txr -f ;; ./mt9x9.tl || ./txr -f mt9x9.tl (each ((i (range 1 9 3))) (each ((j (range 1 9))) (each ((k (list i (+ i 1) (+ i 2)))) (format t "~ax~a=~2a\t" k j (* k j)) ) (put-string "\n") ) (put-line) ) #!/usr/bin/txr -f ;; ./mt9x9.tl || ./txr -f mt9x9.tl (each ((i (range 1 9 3))) (each ((j (range 1 9))) (each ((k (list i (+ i 1) (+ i 2)))) (format t "~ax~a=~2a\t" k j (* k j)) ) (put-string "\n") ) (put-line) ) TXR Lisp SCSH
  58. Code to Code Code to Code #!/usr/bin/dern !# ; ./mt9x9.dern

    || dern mt9x9.dern (print-readably false) (for i from {D+1} to {D+9} step {D+3} (for j from {D+1} to {D+9} (for k from i to (+ i {D+2}) (print k) (print [x]) (print j) (print [=]) (if (< (* k j) {D+10}) (print [ ])) (print (* k j)) (print [|tab|]) ) (print [|newline|]) ) (print [|0A|]) ) #!/usr/bin/dern !# ; ./mt9x9.dern || dern mt9x9.dern (print-readably false) (for i from {D+1} to {D+9} step {D+3} (for j from {D+1} to {D+9} (for k from i to (+ i {D+2}) (print k) (print [x]) (print j) (print [=]) (if (< (* k j) {D+10}) (print [ ])) (print (* k j)) (print [|tab|]) ) (print [|newline|]) ) (print [|0A|]) ) #!/usr/bin/newlisp ; ./mt9x9.lsp || newlispmt9x9.lsp (for (i 1 9 3) (for (j 1 9) (for (k i (+ i 2)) (print (format "%dx%d=%2d\t" k j (* k j))) ) (print "\n") ) (println) ) (exit) #!/usr/bin/newlisp ; ./mt9x9.lsp || newlispmt9x9.lsp (for (i 1 9 3) (for (j 1 9) (for (k i (+ i 2)) (print (format "%dx%d=%2d\t" k j (* k j))) ) (print "\n") ) (println) ) (exit) newLISP Dern
  59. Code to Code Code to Code #!/usr/bin/racket ; ./mt9x9.rkt ||

    racket mt9x9.rkt #lang racket (for ([i (in-range 1 10 3)]) (for ([j (in-range 1 10)]) (for ([k (list i (+ i 1) (+ i 2))]) (printf "~ax~a=" k j) (display (~a (* k j) #:width 2 #:align 'right)) (printf "\t") ) (displayln "") ) (newline) ) #!/usr/bin/racket ; ./mt9x9.rkt || racket mt9x9.rkt #lang racket (for ([i (in-range 1 10 3)]) (for ([j (in-range 1 10)]) (for ([k (list i (+ i 1) (+ i 2))]) (printf "~ax~a=" k j) (display (~a (* k j) #:width 2 #:align 'right)) (printf "\t") ) (displayln "") ) (newline) ) #!/usr/bin/es ;; ./mt9x9.esl || es mt9x9.esl (for i in (1 10 3) (for j in (1 10) (for k in (@ i (i + 1) (+ i 2)) (printf '$(k)x$(j)=') (if ((k * j) < 10) (printf " ")) (printf '$(k * j)\t') ) (printf "\n") ) (print) ) #!/usr/bin/es ;; ./mt9x9.esl || es mt9x9.esl (for i in (1 10 3) (for j in (1 10) (for k in (@ i (i + 1) (+ i 2)) (printf '$(k)x$(j)=') (if ((k * j) < 10) (printf " ")) (printf '$(k * j)\t') ) (printf "\n") ) (print) ) ESlang Racket
  60. Code to Code Code to Code #!/usr/bin/ruby # ./mt9x9.rb ||

    ruby mt9x9.rb for i in (1..9).step(3) for j in (1..9) [i, i+1, i+2].each{|k| print "%dx%d=%2d\t" % [k, j, k*j] } print "\n" end puts end #!/usr/bin/ruby # ./mt9x9.rb || ruby mt9x9.rb for i in (1..9).step(3) for j in (1..9) [i, i+1, i+2].each{|k| print "%dx%d=%2d\t" % [k, j, k*j] } print "\n" end puts end #!/usr/bin/crystal # crystal build mt9x9.cr && ./mt9x9 || ./mt9x9.cr # || crystal mt9x9.cr 1.step(to: 9, by: 3) do |i| 1.upto(9) do |j| [i, i+1, i+2].each do |k| print "#{k}x#{j}=#{k*j<10 ? " " : ""}#{k*j}\t" end puts end puts end #!/usr/bin/crystal # crystal build mt9x9.cr && ./mt9x9 || ./mt9x9.cr # || crystal mt9x9.cr 1.step(to: 9, by: 3) do |i| 1.upto(9) do |j| [i, i+1, i+2].each do |k| print "#{k}x#{j}=#{k*j<10 ? " " : ""}#{k*j}\t" end puts end puts end Crystal Ruby
  61. Code to Code Code to Code # ./mt9x9.joy || joy

    mt9x9.joy 1 [9 <=] [ 1 [9 <=] [ 0 [2 <=] [ dup rotated dupd + dup 48 + putch 'x putch rolldown dup 48 + putch '= putch dup rollup * 'i 2 1 format putchars rolldown '\t putch succ ] while pop '\n putch succ ] while pop '\n putch 3 + ] while pop. # ./mt9x9.joy || joy mt9x9.joy 1 [9 <=] [ 1 [9 <=] [ 0 [2 <=] [ dup rotated dupd + dup 48 + putch 'x putch rolldown dup 48 + putch '= putch dup rollup * 'i 2 1 format putchars rolldown '\t putch succ ] while pop '\n putch succ ] while pop '\n putch 3 + ] while pop. #!/usr/bin/retro ( retro mt9x9.retro ) ~~~ { #1 #4 #7 } [ { #1 #2 #3 #4 #5 #6 #7 #8 #9 } [ dup-pair swap { #0 #1 #2 } [ + dup-pair n:put 'x s:put n:put '= s:put * dup #10 lt? [ '_ s:put ] if '%n\t s:format s:put dup-pair swap ] a:for-each nl drop-pair drop ] a:for-each nl drop ] a:for-each ~~~ #!/usr/bin/retro ( retro mt9x9.retro ) ~~~ { #1 #4 #7 } [ { #1 #2 #3 #4 #5 #6 #7 #8 #9 } [ dup-pair swap { #0 #1 #2 } [ + dup-pair n:put 'x s:put n:put '= s:put * dup #10 lt? [ '_ s:put ] if '%n\t s:format s:put dup-pair swap ] a:for-each nl drop-pair drop ] a:for-each nl drop ] a:for-each ~~~ Retro Joy
  62. Code to Code Code to Code ! Factor mt9x9.factor USING:

    byte-arrays io io.encodings.ascii io.encodings.string kernel math prettyprint ranges sequences ; 1 9 3 <range> [ 9 [1..b] [ over dup 2 + 1 <range> [ 2dup pprint "x" write pprint "=" write over * dup 10 < [ bl pprint ] [ pprint ] if 9 1byte-array ascii decode write ] each drop "\n" write ] each drop nl ] each ! Factor mt9x9.factor USING: byte-arrays io io.encodings.ascii io.encodings.string kernel math prettyprint ranges sequences ; 1 9 3 <range> [ 9 [1..b] [ over dup 2 + 1 <range> [ 2dup pprint "x" write pprint "=" write over * dup 10 < [ bl pprint ] [ pprint ] if 9 1byte-array ascii decode write ] each drop "\n" write ] each drop nl ] each % gs -q -dNODISPLAY -dBATCH mt9x9.ps 1 3 9 { /i exch def 1 1 9 { /j exch def i 1 i 2 add { /k exch def k 1 string cvs print (x) print j 1 string cvs print (=) print k j mul dup 10 lt { ( ) print } if 2 string cvs print (\t) print } for (\n) print } for () = } for % gs -q -dNODISPLAY -dBATCH mt9x9.ps 1 3 9 { /i exch def 1 1 9 { /j exch def i 1 i 2 add { /k exch def k 1 string cvs print (x) print j 1 string cvs print (=) print k j mul dup 10 lt { ( ) print } if 2 string cvs print (\t) print } for (\n) print } for () = } for PostScript Factor
  63. Code to Code Code to Code #!/usr/bin/thune ; ./mt9x9.t ||

    thune mt9x9.t 1 :i [ 1 :j [ i :k [ k prin 'x' prin j prin '=' prin 10 k j mul gt? ift (' ' prin) k j mul prin '^-' prin k inc :k ] 3 loop '^/' prin j inc :j ] 9 loop '^/' prin 3 i add :i ] 3 loop #!/usr/bin/thune ; ./mt9x9.t || thune mt9x9.t 1 :i [ 1 :j [ i :k [ k prin 'x' prin j prin '=' prin 10 k j mul gt? ift (' ' prin) k j mul prin '^-' prin k inc :k ] 3 loop '^/' prin j inc :j ] 9 loop '^/' prin 3 i add :i ] 3 loop #!/usr/bin/gst " ./mt9x9.st || gst mt9x9.st " 1 to: 9 by: 3 do: [ :i | 1 to: 9 do: [ :j | i to: i+2 do: [ :k | Transcript show: k printString, 'x', j printString, '='. k*j < 10 ifTrue: [Transcript show: ' ']. Transcript show: (k*j) printString. Character tab display ]. Character nl display ]. Transcript cr ]. #!/usr/bin/gst " ./mt9x9.st || gst mt9x9.st " 1 to: 9 by: 3 do: [ :i | 1 to: 9 do: [ :j | i to: i+2 do: [ :k | Transcript show: k printString, 'x', j printString, '='. k*j < 10 ifTrue: [Transcript show: ' ']. Transcript show: (k*j) printString. Character tab display ]. Character nl display ]. Transcript cr ]. Smalltalk Thune
  64. Code to Code Code to Code -- ghc mt9x9.hs &&

    ./mt9x9 || runghc mt9x9.hs import Control.Monad main = do forM_ [1,4..9] $ \i -> do forM_ [1..9] $ \j -> do forM_ [i, i+1, i+2] $ \k -> do putStr (show k ++ "x" ++ show j ++ "=" ++ (if (k*j) < 10 then " " else "") ++ show (k*j) ++ "\t") putStrLn "" putChar '\n' -- ghc mt9x9.hs && ./mt9x9 || runghc mt9x9.hs import Control.Monad main = do forM_ [1,4..9] $ \i -> do forM_ [1..9] $ \j -> do forM_ [i, i+1, i+2] $ \k -> do putStr (show k ++ "x" ++ show j ++ "=" ++ (if (k*j) < 10 then " " else "") ++ show (k*j) ++ "\t") putStrLn "" putChar '\n' #!/usr/bin/elixir # ./mt9x9.exs || elixir mt9x9.exs Enum.each(Stream.take_every(1..9, 3), fn i -> Enum.each(Enum.sort(1..9), fn j -> Enum.each([i, i+1, i+2], fn k -> IO.write "#{k}x#{j}=” IO.write ‘#{String.pad_leading(to_string(k*j),2)}\t" end) IO.write "\n" end) IO.puts "" end) #!/usr/bin/elixir # ./mt9x9.exs || elixir mt9x9.exs Enum.each(Stream.take_every(1..9, 3), fn i -> Enum.each(Enum.sort(1..9), fn j -> Enum.each([i, i+1, i+2], fn k -> IO.write "#{k}x#{j}=” IO.write ‘#{String.pad_leading(to_string(k*j),2)}\t" end) IO.write "\n" end) IO.puts "" end) Elixir Haskell
  65. Code to Code Code to Code -- idris mt9x9.idr -o

    mt9x9 && ./mt9x9 item : Nat -> Nat -> String item j k = (show k)++"x"++(show j)++"="++ (if k*j < 10 then " " else "")++(show (k*j))++" " line : Nat -> Nat -> String line i j = unwords $ map (item j) [(i)..(i+2)] block : Nat -> String block i = unlines $ map (line i) [1..9] main : IO () main = putStr $ unlines $ map block [1, 4, 7] -- idris mt9x9.idr -o mt9x9 && ./mt9x9 item : Nat -> Nat -> String item j k = (show k)++"x"++(show j)++"="++ (if k*j < 10 then " " else "")++(show (k*j))++" " line : Nat -> Nat -> String line i j = unwords $ map (item j) [(i)..(i+2)] block : Nat -> String block i = unlines $ map (line i) [1..9] main : IO () main = putStr $ unlines $ map block [1, 4, 7] // pure -c mt9x9.pure -o mt9x9 && ./mt9x9 || pure mt9x9.pure using system; map block [1, 4, 7] with block i = map (line i) (1..9); line i j = map (item j) (i..i+2); item j k = printf ("%dx%d=%2d%s") (k, j, k*j, (if k mod 3~=0 then "\t" else if j==9 then "\n\n" else "\n")); end; // pure -c mt9x9.pure -o mt9x9 && ./mt9x9 || pure mt9x9.pure using system; map block [1, 4, 7] with block i = map (line i) (1..9); line i j = map (item j) (i..i+2); item j k = printf ("%dx%d=%2d%s") (k, j, k*j, (if k mod 3~=0 then "\t" else if j==9 then "\n\n" else "\n")); end; Pure Idris
  66. Code to Code Code to Code // clm -nt mt9x9

    -o mt9x9 && ./mt9x9 module mt9x9 import StdEnv item j k = toString k +++ "x" +++ toString j +++ "=" +++ if (k*j < 10) " " "" +++ toString (k*j) +++ "\t" line i j = map (item j) [i .. i+2] ++ ["\n"] block i = flatten (map (line i) [1 .. 9]) ++ ["\n"] Start = abort (foldr (+++) "" (flatten (map block [1, 4 .. 9]))) // clm -nt mt9x9 -o mt9x9 && ./mt9x9 module mt9x9 import StdEnv item j k = toString k +++ "x" +++ toString j +++ "=" +++ if (k*j < 10) " " "" +++ toString (k*j) +++ "\t" line i j = map (item j) [i .. i+2] ++ ["\n"] block i = flatten (map (line i) [1 .. 9]) ++ ["\n"] Start = abort (foldr (+++) "" (flatten (map block [1, 4 .. 9]))) {-# OPTIONS --guardedness #-} -- agda -i /usr/share/Agda-stdlib/src -c mt9x9.agda && ./mt9x9 module mt9x9 where open import Data.Nat using ( ; _+_; _*_) ℕ open import Data.Nat.Show using (show) open import Data.String using (String; padLeft; _++_; concat) open import Data.List using ([]; map; _ _) ∷ open import Text.Printf using (printf) open import IO using (Main; run; putStr) item : -> -> String ℕ ℕ item j k = printf "%ux%u=%s\t" k j (padLeft ' ' 2 (show (k * j))) line : -> -> String ℕ ℕ line i j = concat (map (item j) (i (i + 1) (i + 2) [])) ++ "\n" ∷ ∷ ∷ block : -> String ℕ block i = concat (map (line i) (1 2 3 4 5 6 7 8 9 [])) ++ "\n" ∷ ∷ ∷ ∷ ∷ ∷ ∷ ∷ ∷ main : Main main = run (putStr (concat (map block (1 4 7 [])))) ∷ ∷ ∷ {-# OPTIONS --guardedness #-} -- agda -i /usr/share/Agda-stdlib/src -c mt9x9.agda && ./mt9x9 module mt9x9 where open import Data.Nat using ( ; _+_; _*_) ℕ open import Data.Nat.Show using (show) open import Data.String using (String; padLeft; _++_; concat) open import Data.List using ([]; map; _ _) ∷ open import Text.Printf using (printf) open import IO using (Main; run; putStr) item : -> -> String ℕ ℕ item j k = printf "%ux%u=%s\t" k j (padLeft ' ' 2 (show (k * j))) line : -> -> String ℕ ℕ line i j = concat (map (item j) (i (i + 1) (i + 2) [])) ++ "\n" ∷ ∷ ∷ block : -> String ℕ block i = concat (map (line i) (1 2 3 4 5 6 7 8 9 [])) ++ "\n" ∷ ∷ ∷ ∷ ∷ ∷ ∷ ∷ ∷ main : Main main = run (putStr (concat (map block (1 4 7 [])))) ∷ ∷ ∷ Agda Clean
  67. Code to Code Code to Code -- se c mt9x9.e

    -clean -o mt9x9 && ./mt9x9 class MT9X9 create {ANY} make feature {ANY} make local i: INTEGER do from i := 1 until i > 9 loop block(i) print("%N") i := i + 3 end end block (i: INTEGER) local j: INTEGER do from j := 1 until j > 9 loop line(i, j) io.put_new_line j := j + 1 end end line (i, j: INTEGER) local k: INTEGER do from k := i until k > i+2 loop io.put_string(k.out + "x" + j.out + "=") io.put_string(if k*j<10 then " " else "" end) io.put_string((k*j).out + "%T") k := k + 1 end end end -- se c mt9x9.e -clean -o mt9x9 && ./mt9x9 class MT9X9 create {ANY} make feature {ANY} make local i: INTEGER do from i := 1 until i > 9 loop block(i) print("%N") i := i + 3 end end block (i: INTEGER) local j: INTEGER do from j := 1 until j > 9 loop line(i, j) io.put_new_line j := j + 1 end end line (i, j: INTEGER) local k: INTEGER do from k := i until k > i+2 loop io.put_string(k.out + "x" + j.out + "=") io.put_string(if k*j<10 then " " else "" end) io.put_string((k*j).out + "%T") k := k + 1 end end end % gplc mt9x9.prolog && ./mt9x9 :- initialization(main). item(I,J,K) :- K =< I+2 -> ( format('%dx%d=%2d\t',[K,J,K*J]), item(I,J,K+1) ); format('~n',[]). line(I,J) :- J =< 9 -> ( item(I,J,I), line(I,J+1) ); nl. block(I) :- I =< 9 -> ( line(I,1), block(I+3) ); halt. main :- block(1). % gplc mt9x9.prolog && ./mt9x9 :- initialization(main). item(I,J,K) :- K =< I+2 -> ( format('%dx%d=%2d\t',[K,J,K*J]), item(I,J,K+1) ); format('~n',[]). line(I,J) :- J =< 9 -> ( item(I,J,I), line(I,J+1) ); nl. block(I) :- I =< 9 -> ( line(I,1), block(I+3) ); halt. main :- block(1). Prolog Eiffel
  68. Code to Code Code to Code % erlc mt9x9.erl &&

    erl -noshell -s mt9x9 start -s init stop -module(mt9x9). -export([start/0]). start() -> [block(I) || I <- lists:seq(1, 9, 3)]. block(I) -> [line(I, J) || J <- lists:seq(1, 9)], io:fwrite("~n"). line(I, J) -> [io:format("~Bx~B=~2B\t", [K, J, K*J]) || K <- lists:seq(I, I+2)], io:nl(). % erlc mt9x9.erl && erl -noshell -s mt9x9 start -s init stop -module(mt9x9). -export([start/0]). start() -> [block(I) || I <- lists:seq(1, 9, 3)]. block(I) -> [line(I, J) || J <- lists:seq(1, 9)], io:fwrite("~n"). line(I, J) -> [io:format("~Bx~B=~2B\t", [K, J, K*J]) || K <- lists:seq(I, I+2)], io:nl(). #!/usr/bin/escript % ./mt9x9.es || escript mt9x9.es main(_) -> [block(I) || I <- lists:seq(1, 9, 3)]. block(I) -> [line(I, J) || J <- lists:seq(1, 9)], io:fwrite("~n"). line(I, J) -> [io:format("~Bx~B=~2B\t", [K, J, K*J]) || K <- lists:seq(I, I+2)], io:nl(). #!/usr/bin/escript % ./mt9x9.es || escript mt9x9.es main(_) -> [block(I) || I <- lists:seq(1, 9, 3)]. block(I) -> [line(I, J) || J <- lists:seq(1, 9)], io:fwrite("~n"). line(I, J) -> [io:format("~Bx~B=~2B\t", [K, J, K*J]) || K <- lists:seq(I, I+2)], io:nl(). EScript Erlang
  69. Code to Code Code to Code // patscc mt9x9.dats -o

    mt9x9 && ./mt9x9 #include "share/atspre_staload.hats" implement main0() = block(1) where { fun item(i: int, j: int, k: int): void = if k <= i+2 then ( print!(k, "x", j, "=", (if k*j < 10 then " " else ""): string, k*j, "\t"); item(i, j, k+1) ) fun line(i: int, j: int): void = if j <= 9 then ( item(i, j, i); print("\n"); line(i, j+1) ) fun block(i: int): void = if i <= 9 then ( line(i, 1); print_newline(); block(i+3) ) } // patscc mt9x9.dats -o mt9x9 && ./mt9x9 #include "share/atspre_staload.hats" implement main0() = block(1) where { fun item(i: int, j: int, k: int): void = if k <= i+2 then ( print!(k, "x", j, "=", (if k*j < 10 then " " else ""): string, k*j, "\t"); item(i, j, k+1) ) fun line(i: int, j: int): void = if j <= 9 then ( item(i, j, i); print("\n"); line(i, j+1) ) fun block(i: int): void = if i <= 9 then ( line(i, 1); print_newline(); block(i+3) ) } #!/usr/bin/miranda -exec || ./mt9x9.mira || miranda -exec mt9x9.mira main = concat (map block [1, 4, 7]) where block i = concat (map line [1..9]) ++ "\n" where line j = concat (map item [i..i+2]) ++ "\n" where item k = shownum k ++ "x" ++ shownum j ++ "=" ++ rjustify 2 (shownum (k*j)) ++ "\t" #!/usr/bin/miranda -exec || ./mt9x9.mira || miranda -exec mt9x9.mira main = concat (map block [1, 4, 7]) where block i = concat (map line [1..9]) ++ "\n" where line j = concat (map item [i..i+2]) ++ "\n" where item k = shownum k ++ "x" ++ shownum j ++ "=" ++ rjustify 2 (shownum (k*j)) ++ "\t" Miranda ATS
  70. Code to Code Code to Code // grain mt9x9.gr ||

    grain run mt9x9.gr.wasm import File from "sys/file" import Range from "range" let item = (j, k) => { File.fdWrite(File.stdout, toString(k) ++ "x") File.fdWrite(File.stdout, toString(j) ++ "=") if (k*j < 10) { File.fdWrite(File.stdout, " " ++ toString(k*j) ++ "\t") } else { File.fdWrite(File.stdout, toString(k*j) ++ "\t") } void } let line = (i, j) => { Range.forEach(k => item(j, k), Range.Inclusive(i, i+2)) print("") } let block = (i) => { Range.forEach(j => line(i*3+1, j), Range.Inclusive(1, 9)) print("") } Range.forEach(i => block(i), Range.Inclusive(0, 2)) // grain mt9x9.gr || grain run mt9x9.gr.wasm import File from "sys/file" import Range from "range" let item = (j, k) => { File.fdWrite(File.stdout, toString(k) ++ "x") File.fdWrite(File.stdout, toString(j) ++ "=") if (k*j < 10) { File.fdWrite(File.stdout, " " ++ toString(k*j) ++ "\t") } else { File.fdWrite(File.stdout, toString(k*j) ++ "\t") } void } let line = (i, j) => { Range.forEach(k => item(j, k), Range.Inclusive(i, i+2)) print("") } let block = (i) => { Range.forEach(j => line(i*3+1, j), Range.Inclusive(1, 9)) print("") } Range.forEach(i => block(i), Range.Inclusive(0, 2)) #!/usr/bin/dc [ ./mt9x9.dc || dc mt9x9.dc ]sz [32 P]sS [ lk n [x] P lj n [=] P lk lj * d 9 !<S n 9 P lk 1 + d sk li 2 + !<K ]sK [ li d sk lK x 10 P lj 1 + d sj 9 !<J ]sJ [ 1 d sj lJ x 10 P li 3 + d si 9 !<I ]sI 1 d si lI x #!/usr/bin/dc [ ./mt9x9.dc || dc mt9x9.dc ]sz [32 P]sS [ lk n [x] P lj n [=] P lk lj * d 9 !<S n 9 P lk 1 + d sk li 2 + !<K ]sK [ li d sk lK x 10 P lj 1 + d sj 9 !<J ]sJ [ 1 d sj lJ x 10 P li 3 + d si 9 !<I ]sI 1 d si lI x DC Grain
  71. Code to Code Code to Code * snobol4 -b mt9x9.sno

    i = 1 block j = 1 line k = i s = "" item s = s k "x" j "=" LPAD(k * j, 2) CHAR(9) k = ?LT(k, i + 2) k + 1 :S(item) OUTPUT = s j = ?LT(j, 9) j + 1 :S(line) OUTPUT = "" i = ?LT(i, 7) i + 3 :S(block) END * snobol4 -b mt9x9.sno i = 1 block j = 1 line k = i s = "" item s = s k "x" j "=" LPAD(k * j, 2) CHAR(9) k = ?LT(k, i + 2) k + 1 :S(item) OUTPUT = s j = ?LT(j, 9) j + 1 :S(line) OUTPUT = "" i = ?LT(i, 7) i + 3 :S(block) END SNOBOL ~~ cognac mt9x9.cog -run Def Item ( Let J; Let K; Puts (K"x"J"="); Put If < 10 * K J then " " else ""; Puts (* K J"\t") ); Def Line ( Let I; Let J; Map (Item J) Range I + I 3; Drop; Print "" ); Def Block ( Let I as block number; Map (Line I) over Range 1 to 10; Drop; Print "" ); (Block); For List (1 4 7); ~~ cognac mt9x9.cog -run Def Item ( Let J; Let K; Puts (K"x"J"="); Put If < 10 * K J then " " else ""; Puts (* K J"\t") ); Def Line ( Let I; Let J; Map (Item J) Range I + I 3; Drop; Print "" ); Def Block ( Let I as block number; Map (Line I) over Range 1 to 10; Drop; Print "" ); (Block); For List (1 4 7); Cognate
  72. Code to Code Code to Code #!/usr/bin/lily # ./mt9x9.lily ||

    lily mt9x9.lily for i in 1...9 by 3: { for j in 1...9: { foreach k in [i, i+1, i+2]: { stdout.write("{}x{}=".format(k, j)) if k*j < 10: { stdout.write(" ") } stdout.write("{}\t".format(k*j)) } stdout.write("\n") } print("") } #!/usr/bin/lily # ./mt9x9.lily || lily mt9x9.lily for i in 1...9 by 3: { for j in 1...9: { foreach k in [i, i+1, i+2]: { stdout.write("{}x{}=".format(k, j)) if k*j < 10: { stdout.write(" ") } stdout.write("{}\t".format(k*j)) } stdout.write("\n") } print("") } Lily #!/usr/bin/icon # ./mt9x9.icn || icon mt9x9.icn # || iconc mt9x9.icn && ./mt9x9 procedure main() local i, j, k every i := 1 to 9 by 3 do { every j := 1 to 9 do { every k := ![i, i+1, i+2] do writes(k, "x", j, "=", right(k*j,2), "\t") writes("\n") } write() } end #!/usr/bin/icon # ./mt9x9.icn || icon mt9x9.icn # || iconc mt9x9.icn && ./mt9x9 procedure main() local i, j, k every i := 1 to 9 by 3 do { every j := 1 to 9 do { every k := ![i, i+1, i+2] do writes(k, "x", j, "=", right(k*j,2), "\t") writes("\n") } write() } end Icon
  73. Code to Code Code to Code // gravity mt9x9.gravity func

    main() { for (var i in [1, 4, 7]) { for (var j in 1...9) { for (var k in i...i+2) { System.put(k, "x", j, "=") if (k*j < 10) System.put(" ") System.put(k*j, "\t") } System.put("\n") } System.print() } System.exit(0) } // gravity mt9x9.gravity func main() { for (var i in [1, 4, 7]) { for (var j in 1...9) { for (var k in i...i+2) { System.put(k, "x", j, "=") if (k*j < 10) System.put(" ") System.put(k*j, "\t") } System.put("\n") } System.print() } System.exit(0) } #!/usr/bin/wren // ./mt9x9.wren || wren mt9x9.wren for (i in (1...10).where {|n| n % 3 == 1 }) { for (j in 1..9) { [i, i+1, i+2].each {|k| System.write("%(k)x%(j)=%(k*j<10?" ":"")%(k*j)\t") } System.write("\n") } System.print() } #!/usr/bin/wren // ./mt9x9.wren || wren mt9x9.wren for (i in (1...10).where {|n| n % 3 == 1 }) { for (j in 1..9) { [i, i+1, i+2].each {|k| System.write("%(k)x%(j)=%(k*j<10?" ":"")%(k*j)\t") } System.write("\n") } System.print() } Wren Gravity
  74. Code to Code Code to Code #!/usr/bin/falcon -M // ./mt9x9.fal

    || falcon mt9x9.fal for i in [1:9:3] for j = 1 to 9 for k in [i, i+1, i+2] s = k*j >> @"$(k)x$(j)=$(s:2r)\t" end printl() end > end #!/usr/bin/falcon -M // ./mt9x9.fal || falcon mt9x9.fal for i in [1:9:3] for j = 1 to 9 for k in [i, i+1, i+2] s = k*j >> @"$(k)x$(j)=$(s:2r)\t" end printl() end > end // flaxc mt9x9.flx && ./mt9x9 || flaxc -run mt9x9.flx import libc as _ import std::io as _ @entry fn main() { for i in [1, 4, 7] { for j in 1...9 { for k in i...i+2 step 1 => printf("%dx%d=%2d\t", k, j, k*j) printf("\n") } println() } } // flaxc mt9x9.flx && ./mt9x9 || flaxc -run mt9x9.flx import libc as _ import std::io as _ @entry fn main() { for i in [1, 4, 7] { for j in 1...9 { for k in i...i+2 step 1 => printf("%dx%d=%2d\t", k, j, k*j) printf("\n") } println() } } Flax Falcon
  75. Code to Code Code to Code #! /usr/bin/gforth \ ./mt9x9.fth

    || gforth mt9x9.fth : mt9x9 10 1 do 10 1 do 3 0 do i k + 1 u.r 120 emit j 1 u.r 61 emit i k + j * 2 u.r 9 emit loop 10 emit loop cr 3 +loop ; mt9x9 bye #! /usr/bin/gforth \ ./mt9x9.fth || gforth mt9x9.fth : mt9x9 10 1 do 10 1 do 3 0 do i k + 1 u.r 120 emit j 1 u.r 61 emit i k + j * 2 u.r 9 emit loop 10 emit loop cr 3 +loop ; mt9x9 bye #!/usr/bin/dao # ./mt9x9.dao || dao mt9x9.dao for(var i = 1:3:10) { for(var j = 1:10) { for(var k in {i, i+1, i+2}) io.writef("%dx%d=%2d\t", k, j, k*j) io.write("\n") } io.writeln() } #!/usr/bin/dao # ./mt9x9.dao || dao mt9x9.dao for(var i = 1:3:10) { for(var j = 1:10) { for(var k in {i, i+1, i+2}) io.writef("%dx%d=%2d\t", k, j, k*j) io.write("\n") } io.writeln() } Dao Forth
  76. Code to Code Code to Code #!/usr/bin/ijconsole NB. ./mt9x9.ijs ||

    ijconsole mt9x9.ijs 3 : 0 '' for_i. 1 + 3 * i. 3 do. for_j. 1 + i. 9 do. s =: '' for_k. i + i. 3 do. s =: s, (":k), 'x', (":j), '=', (>'2.0' 8!:0 k*j), TAB end. smoutput s end. smoutput '' end. ) exit 0 #!/usr/bin/ijconsole NB. ./mt9x9.ijs || ijconsole mt9x9.ijs 3 : 0 '' for_i. 1 + 3 * i. 3 do. for_j. 1 + i. 9 do. s =: '' for_k. i + i. 3 do. s =: s, (":k), 'x', (":j), '=', (>'2.0' 8!:0 k*j), TAB end. smoutput s end. smoutput '' end. ) exit 0 #!/usr/bin/nial -defs # ./mt9x9.ndf || nial -defs mt9x9.ndf for i with 1 + (3 * tell 3) do for j with count 9 do for k with i + tell 3 do writechars link (string k) `x (string j) `=; if (k*j) < 10 then writechars ' ' endif; writechars link (string (k*j)) (char 9) endfor; writechars char 10 endfor; write '' endfor; bye #!/usr/bin/nial -defs # ./mt9x9.ndf || nial -defs mt9x9.ndf for i with 1 + (3 * tell 3) do for j with count 9 do for k with i + tell 3 do writechars link (string k) `x (string j) `=; if (k*j) < 10 then writechars ' ' endif; writechars link (string (k*j)) (char 9) endfor; writechars char 10 endfor; write '' endfor; bye Nial J
  77. Code to Code Code to Code #!/usr/bin/bc -q # ./mt9x9.bc

    || bc -q mt9x9.bc for (i = 1; i <= 9; i += 3) { for (j = 1; j <= 9; j++) { for (k = i; k <= i+2; k++) { print k, "x", j, "=" if (k*j < 10) " " print k*j, "\t" } print "\n" } " " } quit #!/usr/bin/bc -q # ./mt9x9.bc || bc -q mt9x9.bc for (i = 1; i <= 9; i += 3) { for (j = 1; j <= 9; j++) { for (k = i; k <= i+2; k++) { print k, "x", j, "=" if (k*j < 10) " " print k*j, "\t" } print "\n" } " " } quit #!/usr/bin/genius # ./mt9x9.gel || genius mt9x9.gel for i = 1 to 9 by 3 do ( for j = 1 to 9 do ( for k in [i, i+1, i+2] do ( printn(k+"x"+j+"="); if k*j < 10 then printn(" "); printn(k*j+"\t") ); printn("\n") ); print("") ) #!/usr/bin/genius # ./mt9x9.gel || genius mt9x9.gel for i = 1 to 9 by 3 do ( for j = 1 to 9 do ( for k in [i, i+1, i+2] do ( printn(k+"x"+j+"="); if k*j < 10 then printn(" "); printn(k*j+"\t") ); printn("\n") ); print("") ) GEL BC
  78. Code to Code Code to Code // chpl mt9x9.chpl &&

    ./mt9x9 for i in 1..9 by 3 { for j in 1..9 { for k in [i, i+1, i+2] { writef("%{#}x%{#}=%{##}\t", k, j, k*j); } write('\n'); } writeln(); } // chpl mt9x9.chpl && ./mt9x9 for i in 1..9 by 3 { for j in 1..9 { for k in [i, i+1, i+2] { writef("%{#}x%{#}=%{##}\t", k, j, k*j); } write('\n'); } writeln(); } % nelson-cli -q -f mt9x9.nlf for i = 1:3:9 for j = 1:9 s = ""; for k = [i, i+1, i+2] s = s + sprintf("%dx%d=%2d\t", k, j, k*j); end disp(s); end disp(""); end exit() % nelson-cli -q -f mt9x9.nlf for i = 1:3:9 for j = 1:9 s = ""; for k = [i, i+1, i+2] s = s + sprintf("%dx%d=%2d\t", k, j, k*j); end disp(s); end disp(""); end exit() Nelson Chapel
  79. Code to Code Code to Code (* mathicsscript mt9x9.wl *)

    For[ i = 1, i <= 9, i += 3, For[ j = 1, j <= 9, j++, For[ k = i, k <= i+2, k++, WriteString[ OutputStream[ "stdout", 1 ], k, "x", j, "=" ]; WriteString[ OutputStream[ "stdout", 1 ], If[ k*j < 10, " ", "" ] ]; WriteString[ OutputStream[ "stdout", 1 ], k*j, "\t" ]; ]; WriteString[ OutputStream[ "stdout", 1 ], "\n" ]; ]; If[ i < 7, Print[ "" ] ]; ]; (* mathicsscript mt9x9.wl *) For[ i = 1, i <= 9, i += 3, For[ j = 1, j <= 9, j++, For[ k = i, k <= i+2, k++, WriteString[ OutputStream[ "stdout", 1 ], k, "x", j, "=" ]; WriteString[ OutputStream[ "stdout", 1 ], If[ k*j < 10, " ", "" ] ]; WriteString[ OutputStream[ "stdout", 1 ], k*j, "\t" ]; ]; WriteString[ OutputStream[ "stdout", 1 ], "\n" ]; ]; If[ i < 7, Print[ "" ] ]; ]; #!/usr/bin/octave-cli % ./mt9x9.m || octave-cli mt9x9.m for i = (1:3:9) for j = (1:9) for k = [i, i+1, i+2] printf('%dx%d=%2d\t', k, j, k*j); endfor puts("\n"); endfor disp(''); endfor #!/usr/bin/octave-cli % ./mt9x9.m || octave-cli mt9x9.m for i = (1:3:9) for j = (1:9) for k = [i, i+1, i+2] printf('%dx%d=%2d\t', k, j, k*j); endfor puts("\n"); endfor disp(''); endfor MATLAB Wolfram
  80. Code to Code Code to Code #!/usr/bin/ampl # ./mt9x9.run ||

    ampl mt9x9.run for {i in 1 .. 9 by 3} { for {j in 1 .. 9} { for {k in {i, i+1, i+2}} { printf "%dx%d=%2d\t", k, j, k*j; } printf "\n"; } printf "\n"; } #!/usr/bin/ampl # ./mt9x9.run || ampl mt9x9.run for {i in 1 .. 9 by 3} { for {j in 1 .. 9} { for {k in {i, i+1, i+2}} { printf "%dx%d=%2d\t", k, j, k*j; } printf "\n"; } printf "\n"; } ! gfortran mt9x9.f90 -o mt9x9 && ./mt9x9 program mt9x9 implicit none integer :: i, j, k character(len=24) :: format do i = 1, 9, 3 format = "(3(i1, a, i1, a, i2, a))" write(*,format) ((k, 'x', j, '=', k*j, char(9), k = i, i+2), j = 1, 9) write(*,*) end do end program mt9x9 ! gfortran mt9x9.f90 -o mt9x9 && ./mt9x9 program mt9x9 implicit none integer :: i, j, k character(len=24) :: format do i = 1, 9, 3 format = "(3(i1, a, i1, a, i2, a))" write(*,format) ((k, 'x', j, '=', k*j, char(9), k = i, i+2), j = 1, 9) write(*,*) end do end program mt9x9 Fortran AMPL
  81. Code to Code Code to Code #!/usr/bin/Rscript # ./mt9x9.R ||

    Rscript mt9x9.R for(i in seq(1, 9, 3)) { for(j in 1:9) { for(k in list(i, i+1, i+2)) { cat(sprintf("%dx%d=%2d\t", k, j, k*j)) } cat("\n") } cat("\n") } #!/usr/bin/Rscript # ./mt9x9.R || Rscript mt9x9.R for(i in seq(1, 9, 3)) { for(j in 1:9) { for(k in list(i, i+1, i+2)) { cat(sprintf("%dx%d=%2d\t", k, j, k*j)) } cat("\n") } cat("\n") } ; gdl -q -e mt9x9 pro mt9x9 for i = 1, 9, 3 do begin for j = 1, 9 do begin for k = i, i+2 do begin print, k,"x",j,"=",k*j,string(9b), $ format='($,I1,A,I1,A,I2,A)' endfor print, string(10b), format='($,A)' endfor print endfor end ; gdl -q -e mt9x9 pro mt9x9 for i = 1, 9, 3 do begin for j = 1, 9 do begin for k = i, i+2 do begin print, k,"x",j,"=",k*j,string(9b), $ format='($,I1,A,I1,A,I2,A)' endfor print, string(10b), format='($,A)' endfor print endfor end IDL R
  82. Code to Code Code to Code #!/usr/bin/gnuplot # ./mt9x9.plt ||

    gnuplot mt9x9.plt do for [i = 1:9:3] for [j = 1:9] { s = "" do for [k = i:i+2] { s = s.sprintf("%dx%d=%2d\t", k, j, k*j) } if (j == 9) {print s."\n"} else {print s} } #!/usr/bin/gnuplot # ./mt9x9.plt || gnuplot mt9x9.plt do for [i = 1:9:3] for [j = 1:9] { s = "" do for [k = i:i+2] { s = s.sprintf("%dx%d=%2d\t", k, j, k*j) } if (j == 9) {print s."\n"} else {print s} } /* maxima --very-quiet < mt9x9.mac */ ttyoff: true; for i: 1 step 3 thru 9 do ( for j: 1 thru 9 do ( for k in [i, i+1, i+2] do ( printf(true, "~dx~d=~2d~a", k, j, k*j, tab) ), printf(true, "~%") ), newline() ); /* maxima --very-quiet < mt9x9.mac */ ttyoff: true; for i: 1 step 3 thru 9 do ( for j: 1 thru 9 do ( for k in [i, i+1, i+2] do ( printf(true, "~dx~d=~2d~a", k, j, k*j, tab) ), printf(true, "~%") ), newline() ); Maxima Gnuplot
  83. Code to Code Code to Code * pspp mt9x9.sps NEW

    FILE. INPUT PROGRAM. STRING #s #s0 TO #s2 (A6). LOOP #i = 1 TO 9 BY 3. LOOP #j = 1 TO 9. LOOP #k = #i TO #i+2. COMPUTE #s = CONCAT(STRING(#k,F1),"x",STRING(#j,F1),"=",STRING(#k*#j,F2)). IF(#k = #i) #s0 = #s. IF(#k = #i+1) #s1 = #s. IF(#k = #i+2) #s2 = #s. END LOOP. PRINT / #s0(A6) " " #s1(A6) " " #s2(A6). END LOOP. PRINT. END LOOP. WRITE. END FILE. END INPUT PROGRAM. EXECUTE. * pspp mt9x9.sps NEW FILE. INPUT PROGRAM. STRING #s #s0 TO #s2 (A6). LOOP #i = 1 TO 9 BY 3. LOOP #j = 1 TO 9. LOOP #k = #i TO #i+2. COMPUTE #s = CONCAT(STRING(#k,F1),"x",STRING(#j,F1),"=",STRING(#k*#j,F2)). IF(#k = #i) #s0 = #s. IF(#k = #i+1) #s1 = #s. IF(#k = #i+2) #s2 = #s. END LOOP. PRINT / #s0(A6) " " #s1(A6) " " #s2(A6). END LOOP. PRINT. END LOOP. WRITE. END FILE. END INPUT PROGRAM. EXECUTE. #!/usr/bin/julia # ./mt9x9.jl || julia mt9x9.jl using Printf for i in 1:3:9, j = 1:9, k = [i, i+1, i+2] @printf("%dx%d=%2d", k, j, k*j) print(k!=i+2 ? "\t" : j==9 ? "\n\n" : "\n") end #!/usr/bin/julia # ./mt9x9.jl || julia mt9x9.jl using Printf for i in 1:3:9, j = 1:9, k = [i, i+1, i+2] @printf("%dx%d=%2d", k, j, k*j) print(k!=i+2 ? "\t" : j==9 ? "\n\n" : "\n") end Julia SPSS
  84. Code to Code Code to Code #!/usr/bin/monkeylang // ./mt9x9.mon ||

    monkeylang mt9x9.mon i = 1 for (i <= 9) { foreach j in 1..9 { foreach k in [i, i+1, i+2] { printf("%dx%d=%2d\t", k, j, k*j) } puts("\n") } puts("\n") i += 3 } #!/usr/bin/monkeylang // ./mt9x9.mon || monkeylang mt9x9.mon i = 1 for (i <= 9) { foreach j in 1..9 { foreach k in [i, i+1, i+2] { printf("%dx%d=%2d\t", k, j, k*j) } puts("\n") } puts("\n") i += 3 } #!/usr/bin/io // ./mt9x9.io || io mt9x9.io for(i, 1, 9, 3, for(j, 1, 9, list(i, i+1, i+2) foreach(k, write(k, "x", j, "=", if(k*j<10," ",""), k*j, "\t") ) "" println ) writeln ) #!/usr/bin/io // ./mt9x9.io || io mt9x9.io for(i, 1, 9, 3, for(j, 1, 9, list(i, i+1, i+2) foreach(k, write(k, "x", j, "=", if(k*j<10," ",""), k*j, "\t") ) "" println ) writeln ) Io Monkey
  85. Code to Code Code to Code // iverilog mt9x9.vlg -o

    mt9x9 && ./mt9x9 module mt9x9; integer i, j, k; initial begin for(i = 1; i <= 9; i += 3) begin for(j = 1; j <= 9; j++) begin for(k = i; k <= i+2; k++) begin $write("%0dx%0d=%2d\t", k, j, k*j); end $write("\n"); end $display(); end end endmodule // iverilog mt9x9.vlg -o mt9x9 && ./mt9x9 module mt9x9; integer i, j, k; initial begin for(i = 1; i <= 9; i += 3) begin for(j = 1; j <= 9; j++) begin for(k = i; k <= i+2; k++) begin $write("%0dx%0d=%2d\t", k, j, k*j); end $write("\n"); end $display(); end end endmodule -- ghdl -c mt9x9.vhd -e mt9x9 && ./mt9x9 LIBRARY std; USE std.TEXTIO.all; entity mt9x9 is end mt9x9; architecture mt9x9 of mt9x9 is begin process variable i, j, k: integer; variable s: line; begin for i in 1 to 9 loop next when i mod 3 /= 1; for j in 1 to 9 loop for k in i to i+2 loop write(s, k); write(s, 'x'); write(s, j); write(s, '='); write(s, k*j, right, 2); write(s, character'val(9)); end loop; writeline(OUTPUT, s); end loop; write(s, character'val(0)); writeline(OUTPUT, s); end loop; wait; end process; end mt9x9; -- ghdl -c mt9x9.vhd -e mt9x9 && ./mt9x9 LIBRARY std; USE std.TEXTIO.all; entity mt9x9 is end mt9x9; architecture mt9x9 of mt9x9 is begin process variable i, j, k: integer; variable s: line; begin for i in 1 to 9 loop next when i mod 3 /= 1; for j in 1 to 9 loop for k in i to i+2 loop write(s, k); write(s, 'x'); write(s, j); write(s, '='); write(s, k*j, right, 2); write(s, character'val(9)); end loop; writeline(OUTPUT, s); end loop; write(s, character'val(0)); writeline(OUTPUT, s); end loop; wait; end process; end mt9x9; VHDL Verilog
  86. Code to Code Code to Code #!/usr/bin/mumps ; ./mt9x9.mps ||

    mumps mt9x9.mps mt9x9 for i=1:3:9 do . for j=1:1:9 do .. for k=i,i+1,i+2 do ... write k,"x",j,"=",$justify(k*j,2),$char(9) .. write $char(10) . write ! #!/usr/bin/mumps ; ./mt9x9.mps || mumps mt9x9.mps mt9x9 for i=1:3:9 do . for j=1:1:9 do .. for k=i,i+1,i+2 do ... write k,"x",j,"=",$justify(k*j,2),$char(9) .. write $char(10) . write ! // daScript mt9x9.das require strings [export] def main for i in [[int[3] 1; 4; 7]] for j in range(1, 10) for k in range(i, i+3) print("{k}x{j}={format("%2d", k*j)}\t") print("\n") print("\n") // daScript mt9x9.das require strings [export] def main for i in [[int[3] 1; 4; 7]] for j in range(1, 10) for k in range(i, i+3) print("{k}x{j}={format("%2d", k*j)}\t") print("\n") print("\n") daScript MUMPS
  87. Code to Code Code to Code \ abclang < mt9x9.abc

    FOR i IN {1; 4; 7}: FOR j IN {1..9}: FOR k IN {i..i+2}: WRITE "`k`x`j`=`k*j>>2``"">>2`" WRITE / WRITE / \ abclang < mt9x9.abc FOR i IN {1; 4; 7}: FOR j IN {1..9}: FOR k IN {i..i+2}: WRITE "`k`x`j`=`k*j>>2``"">>2`" WRITE / WRITE / // fsharpc mt9x9.fs && mono mt9x9.exe // || fsharpi --quiet --exec mt9x9.fs module mt9x9 for i in 1..3..9 do for j in 1..9 do List.iter (fun k -> printf "%dx%d=%2d\t" k j (k*j)) [i; i+1; i+2] printf "\n" printfn "" // fsharpc mt9x9.fs && mono mt9x9.exe // || fsharpi --quiet --exec mt9x9.fs module mt9x9 for i in 1..3..9 do for j in 1..9 do List.iter (fun k -> printf "%dx%d=%2d\t" k j (k*j)) [i; i+1; i+2] printf "\n" printfn "" F# ABC
  88. Code to Code Code to Code #!/usr/bin/python3 # ./mt9x9.py ||

    python3 mt9x9.py for i in range(1, 10, 3): for j in range(1, 10): for k in [i, i+1, i+2]: print(f"{k}x{j}={k*j:2}", end='\t') print(end='\n') print() #!/usr/bin/python3 # ./mt9x9.py || python3 mt9x9.py for i in range(1, 10, 3): for j in range(1, 10): for k in [i, i+1, i+2]: print(f"{k}x{j}={k*j:2}", end='\t') print(end='\n') print() #!/usr/bin/booi // booc mt9x9.boo && mono mt9x9.exe || ./mt9x9.boo // || booi mt9x9.boo for i in range(1, 10, 3): for j in range(1, 10): for k as int in [i, i+1, i+2]: System.Console.Write("${k}x${j}=") if k*j < 10: System.Console.Write(" ") System.Console.Write("${k*j}\t") print("") print #!/usr/bin/booi // booc mt9x9.boo && mono mt9x9.exe || ./mt9x9.boo // || booi mt9x9.boo for i in range(1, 10, 3): for j in range(1, 10): for k as int in [i, i+1, i+2]: System.Console.Write("${k}x${j}=") if k*j < 10: System.Console.Write(" ") System.Console.Write("${k*j}\t") print("") print Boo Python
  89. Code to Code Code to Code // lobster mt9x9.lobster for([1,

    4, 7]) i: for(9) J: let j = J + 1 var s = "" for([i, i+1, i+2]) k: s += "{k}x{j}={if k*j<10: " " else: ""}{k*j}\t" print s print "" // lobster mt9x9.lobster for([1, 4, 7]) i: for(9) J: let j = J + 1 var s = "" for([i, i+1, i+2]) k: s += "{k}x{j}={if k*j<10: " " else: ""}{k*j}\t" print s print "" # nim compile mt9x9.nim && ./mt9x9 import strformat for i in countup(1, 9, 3): for j in 1..9: for k in [i, i+1, i+2]: write(stdout, k, 'x', j, '=', &"{k*j:2d}", '\t') writeLine(stdout, "") echo() # nim compile mt9x9.nim && ./mt9x9 import strformat for i in countup(1, 9, 3): for j in 1..9: for k in [i, i+1, i+2]: write(stdout, k, 'x', j, '=', &"{k*j:2d}", '\t') writeLine(stdout, "") echo() Nim Lobster
  90. Code to Code Code to Code \: zoem -i mt9x9

    \set{i}{1} \while{\let{\i <= 9}}{ \set{j}{1} \while{\let{\j <= 9}}{ \set{k}{\i} \set{K}{0} \while{\let{\K <= 2}}{ \setx{k}{\let{\i + \K}} \write{-}{txt}{\k\,x\j\,=} \set{s}{\let{\k * \j}} \if{\let{\s < 10}}{\write{-}{txt}{ }}{} \write{-}{txt}{\s } \setx{K}{\let{\K + 1}} } \write{-}{txt}{\|} \setx{j}{\let{\j + 1}} } \write{-}{txt}{\|} \setx{i}{\let{\i + 3}} } \: zoem -i mt9x9 \set{i}{1} \while{\let{\i <= 9}}{ \set{j}{1} \while{\let{\j <= 9}}{ \set{k}{\i} \set{K}{0} \while{\let{\K <= 2}}{ \setx{k}{\let{\i + \K}} \write{-}{txt}{\k\,x\j\,=} \set{s}{\let{\k * \j}} \if{\let{\s < 10}}{\write{-}{txt}{ }}{} \write{-}{txt}{\s } \setx{K}{\let{\K + 1}} } \write{-}{txt}{\|} \setx{j}{\let{\j + 1}} } \write{-}{txt}{\|} \setx{i}{\let{\i + 3}} } Zoem -- sqlite3 < mt9x9.sql .mode tabs CREATE TABLE t(j INT, i INT); WITH RECURSIVE for(j) AS (VALUES(1) UNION ALL SELECT j+1 FROM for WHERE j < 9) INSERT INTO t SELECT j, 1 FROM for; SELECT i||'x'||j||'='||SUBSTR(' '||(i*j),-2,2), (i+1)||'x'||j||'='||SUBSTR(' '||((i+1)*j),-2,2), (i+2)||'x'||j||'='||SUBSTR(' '||((i+2)*j),-2,2) FROM t; SELECT ''; UPDATE t SET i = i + 3; SELECT i||'x'||j||'='||SUBSTR(' '||(i*j),-2,2), (i+1)||'x'||j||'='||SUBSTR(' '||((i+1)*j),-2,2), (i+2)||'x'||j||'='||SUBSTR(' '||((i+2)*j),-2,2) FROM t; SELECT ''; UPDATE t SET i = i + 3; SELECT i||'x'||j||'='||SUBSTR(' '||(i*j),-2,2), (i+1)||'x'||j||'='||SUBSTR(' '||((i+1)*j),-2,2), (i+2)||'x'||j||'='||SUBSTR(' '||((i+2)*j),-2,2) FROM t; SELECT ''; -- sqlite3 < mt9x9.sql .mode tabs CREATE TABLE t(j INT, i INT); WITH RECURSIVE for(j) AS (VALUES(1) UNION ALL SELECT j+1 FROM for WHERE j < 9) INSERT INTO t SELECT j, 1 FROM for; SELECT i||'x'||j||'='||SUBSTR(' '||(i*j),-2,2), (i+1)||'x'||j||'='||SUBSTR(' '||((i+1)*j),-2,2), (i+2)||'x'||j||'='||SUBSTR(' '||((i+2)*j),-2,2) FROM t; SELECT ''; UPDATE t SET i = i + 3; SELECT i||'x'||j||'='||SUBSTR(' '||(i*j),-2,2), (i+1)||'x'||j||'='||SUBSTR(' '||((i+1)*j),-2,2), (i+2)||'x'||j||'='||SUBSTR(' '||((i+2)*j),-2,2) FROM t; SELECT ''; UPDATE t SET i = i + 3; SELECT i||'x'||j||'='||SUBSTR(' '||(i*j),-2,2), (i+1)||'x'||j||'='||SUBSTR(' '||((i+1)*j),-2,2), (i+2)||'x'||j||'='||SUBSTR(' '||((i+2)*j),-2,2) FROM t; SELECT ''; SQL
  91. Code to Code Code to Code *> cobc -Fx mt9x9.cob

    && ./mt9x9 || cobc -Fxj mt9x9.cob identification division. program-id. mt9x9. data division. working-storage section. 01 i pic 9. 01 j pic 9. 01 k pic 9. 01 l pic 9. 01 kj pic z9. procedure division. perform varying i from 0 by 3 until i greater than 8 perform with test after varying j from 1 by 1 until j equal 9 perform varying l from 1 by 1 until l greater than 3 add i l giving k multiply k by j giving kj display k "x" j "=" kj x"09" with no advancing end-perform display x"0a" with no advancing end-perform display x"00" end-perform stop run. *> cobc -Fx mt9x9.cob && ./mt9x9 || cobc -Fxj mt9x9.cob identification division. program-id. mt9x9. data division. working-storage section. 01 i pic 9. 01 j pic 9. 01 k pic 9. 01 l pic 9. 01 kj pic z9. procedure division. perform varying i from 0 by 3 until i greater than 8 perform with test after varying j from 1 by 1 until j equal 9 perform varying l from 1 by 1 until l greater than 3 add i l giving k multiply k by j giving kj display k "x" j "=" kj x"09" with no advancing end-perform display x"0a" with no advancing end-perform display x"00" end-perform stop run. COBOL bloop mt9x9.bloop <<< 'MT9X9[].' DEFINE PROCEDURE ''MT9X9'' [N]: BLOCK 0: BEGIN CELL(0) <= 1; LOOP 3 TIMES: BLOCK 1: BEGIN CELL(1) <= 1; LOOP 9 TIMES: BLOCK 2: BEGIN CELL(2) <= CELL(0); LOOP 3 TIMES: BLOCK 3: BEGIN PRINT [CELL(2), 'x', CELL(1), '=']; IF CELL(2) * CELL(1) < 10, THEN: PRINT [' ']; PRINT [CELL(2) * CELL(1), '⇥']; CELL(2) <= CELL(2) + 1; BLOCK 3: END; PRINT [' ']; CELL(1) <= CELL(1) + 1; BLOCK 2: END; PRINT [' ']; CELL(0) <= CELL(0) + 3; BLOCK 1: END; BLOCK 0: END. bloop mt9x9.bloop <<< 'MT9X9[].' DEFINE PROCEDURE ''MT9X9'' [N]: BLOCK 0: BEGIN CELL(0) <= 1; LOOP 3 TIMES: BLOCK 1: BEGIN CELL(1) <= 1; LOOP 9 TIMES: BLOCK 2: BEGIN CELL(2) <= CELL(0); LOOP 3 TIMES: BLOCK 3: BEGIN PRINT [CELL(2), 'x', CELL(1), '=']; IF CELL(2) * CELL(1) < 10, THEN: PRINT [' ']; PRINT [CELL(2) * CELL(1), '⇥']; CELL(2) <= CELL(2) + 1; BLOCK 3: END; PRINT [' ']; CELL(1) <= CELL(1) + 1; BLOCK 2: END; PRINT [' ']; CELL(0) <= CELL(0) + 3; BLOCK 1: END; BLOCK 0: END. BLooP
  92. Code to Code Code to Code /* cantonese mt9x9.cantonese */

    | 甲| 從 0 行到 3 | 乙| 從 1 行到 10 講嘢: | 列| 係 "" | 丙| 從 | 甲 乘 3 加 1| 行到 | 甲 乘 3 加 4| 講嘢: | 列| 係 | 列 加 str( 丙) 加 "x" 加 str( 乙) 加 "="| 如果 | 丙 乘 乙 比唔上 10| 嘅話 -> { 講嘢: | 列| 係 | 列 加 " "| } 講嘢: | 列| 係 | 列 加 str( 丙 乘 乙) 加 "\t"| 行晒 畀我睇下 | 列| 點樣先? 行晒 畀我睇下 "" 點樣先? 行晒 /* cantonese mt9x9.cantonese */ | 甲| 從 0 行到 3 | 乙| 從 1 行到 10 講嘢: | 列| 係 "" | 丙| 從 | 甲 乘 3 加 1| 行到 | 甲 乘 3 加 4| 講嘢: | 列| 係 | 列 加 str( 丙) 加 "x" 加 str( 乙) 加 "="| 如果 | 丙 乘 乙 比唔上 10| 嘅話 -> { 講嘢: | 列| 係 | 列 加 " "| } 講嘢: | 列| 係 | 列 加 str( 丙 乘 乙) 加 "\t"| 行晒 畀我睇下 | 列| 點樣先? 行晒 畀我睇下 "" 點樣先? 行晒 Cantonese 批曰。『wenyan mt9x9.wy 』。 有數一名之曰「甲」。 恆為是。若「甲」不小於十者乃止也。 有數一名之曰「乙」。 恆為是。若「乙」不小於十者乃止也。 有數「甲」名之曰「丙」。 吾有一言。名之曰「列」。 恆為是。若「丙」不小於「甲」加三者乃止也。 乘「丙」以「乙」名之曰「果」。 加「列」以「丙」。昔之「列」者今其是矣。 加「列」以『x 』。昔之「列」者今其是矣。 加「列」以「乙」。昔之「列」者今其是矣。 加「列」以『= 』。昔之「列」者今其是矣。 若「果」小於十者 加「列」以『 』。昔之「列」者今其是矣也。 加「列」以「果」。昔之「列」者今其是矣。 加「列」以『\t 』。昔之「列」者今其是矣。 加「丙」以一。昔之「丙」者今其是矣。 云云。 吾有一言。曰「列」。書之。 加「乙」以一。昔之「乙」者今其是矣。 云云。 書之。 加「甲」以三。昔之「甲」者今其是矣。 云云。 批曰。『wenyan mt9x9.wy 』。 有數一名之曰「甲」。 恆為是。若「甲」不小於十者乃止也。 有數一名之曰「乙」。 恆為是。若「乙」不小於十者乃止也。 有數「甲」名之曰「丙」。 吾有一言。名之曰「列」。 恆為是。若「丙」不小於「甲」加三者乃止也。 乘「丙」以「乙」名之曰「果」。 加「列」以「丙」。昔之「列」者今其是矣。 加「列」以『x 』。昔之「列」者今其是矣。 加「列」以「乙」。昔之「列」者今其是矣。 加「列」以『= 』。昔之「列」者今其是矣。 若「果」小於十者 加「列」以『 』。昔之「列」者今其是矣也。 加「列」以「果」。昔之「列」者今其是矣。 加「列」以『\t 』。昔之「列」者今其是矣。 加「丙」以一。昔之「丙」者今其是矣。 云云。 吾有一言。曰「列」。書之。 加「乙」以一。昔之「乙」者今其是矣。 云云。 書之。 加「甲」以三。昔之「甲」者今其是矣。 云云。 Wenyan
  93. Reference Reference Rosetta Code <https://www.rosettacode.org/wiki/Multiplication_tables> Learn X in Y minutes

    <https://learnxinyminutes.com/> Fibonacci Benchmark <https://github.com/drujensen/fib> 99 Bottles of Beer <https://www.99-bottles-of-beer.net/> Excluded target languages 11l, A+, APL, Assembly, Brainfuck, Crack, Eliza, K, Q, Red, Sawzall, Self, Sidef, Voodoo