Jump to content

Multiplication tables: Difference between revisions

(CoffeeScript)
Line 577:
=={{header|CoffeeScript}}==
<lang coffeescript>
pad = (s, n=4, c=' ') ->
s = s.toString()
result = ''
padding = n - s.length
while result.length < padding
result += c
result + s
 
print_multiplication_tables = (n) ->
width = 4
pad = (s, n=4width, c=' ') ->
s = s.toString()
result = ''
padding = n - s.length
while result.length < padding
result += c
result + s
 
s = pad('') + '|'
for i in [1..n]
Line 607 ⟶ 608:
print_multiplication_tables 12
 
</lang>
output
Line 626 ⟶ 629:
12| 144
</lang>
 
 
=={{header|Common Lisp}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.