Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -0,0 +1,31 @@
|
|||
print_multiplication_tables = (n) ->
|
||||
width = 4
|
||||
|
||||
pad = (s, n=width, c=' ') ->
|
||||
s = s.toString()
|
||||
result = ''
|
||||
padding = n - s.length
|
||||
while result.length < padding
|
||||
result += c
|
||||
result + s
|
||||
|
||||
s = pad('') + '|'
|
||||
for i in [1..n]
|
||||
s += pad i
|
||||
console.log s
|
||||
|
||||
s = pad('', width, '-') + '+'
|
||||
for i in [1..n]
|
||||
s += pad '', width, '-'
|
||||
console.log s
|
||||
|
||||
|
||||
for i in [1..n]
|
||||
s = pad i
|
||||
s += '|'
|
||||
s += pad '', width*(i - 1)
|
||||
for j in [i..n]
|
||||
s += pad i*j
|
||||
console.log s
|
||||
|
||||
print_multiplication_tables 12
|
||||
Loading…
Add table
Add a link
Reference in a new issue