Multiplication tables: Difference between revisions
Content added Content deleted
(→Tcl: Added implementation) |
Underscore (talk | contribs) (Added Haskell.) |
||
Line 5: | Line 5: | ||
=={{header|ALGOL 68}}== |
=={{header|ALGOL 68}}== |
||
<lang |
<lang Algol68>main:( |
||
INT max = 12; |
INT max = 12; |
||
STRING empty cell = " "; |
STRING empty cell = " "; |
||
Line 39: | Line 39: | ||
</pre> |
</pre> |
||
=={{header|Haskell}}== |
|||
<lang haskell>import Text.Printf |
|||
main = do |
|||
putStrLn $ " x" ++ concatMap fmt [1..12] |
|||
mapM_ putStrLn $ zipWith f [1..12] $ iterate (" " ++) "" |
|||
where f n s = fmt n ++ s ++ concatMap (fmt . (*n)) [n..12] |
|||
fmt n = printf "%4d" (n :: Int)</lang> |
|||
=={{header|Tcl}}== |
=={{header|Tcl}}== |