A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
|
|
@ -0,0 +1,21 @@
|
|||
class Main
|
||||
{
|
||||
static Void multiplicationTable (Int n)
|
||||
{
|
||||
// print column headings
|
||||
echo (" |" + (1..n).map |Int a -> Str| { a.toStr.padl(4)}.join("") )
|
||||
echo ("-----" + (1..n).map { "----" }.join("") )
|
||||
// work through each row
|
||||
(1..n).each |i|
|
||||
{
|
||||
echo ( i.toStr.padl(4) + "|" +
|
||||
Str.spaces(4*(i-1)) +
|
||||
(i..n).map |Int j -> Str| { (i*j).toStr.padl(4)}.join("") )
|
||||
}
|
||||
}
|
||||
|
||||
public static Void main ()
|
||||
{
|
||||
multiplicationTable (12)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue