Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
18
Task/Multiplication-tables/Axe/multiplication-tables.axe
Normal file
18
Task/Multiplication-tables/Axe/multiplication-tables.axe
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
Fix 5
|
||||
ClrDraw
|
||||
For(I,1,10)
|
||||
Text(I-1*9,0,I▶Dec)
|
||||
Text(91,I*7+1,I▶Dec)
|
||||
End
|
||||
|
||||
For(J,1,8)
|
||||
For(I,J,10)
|
||||
Text(I-1*9,J*7+1,I*J▶Dec)
|
||||
End
|
||||
End
|
||||
|
||||
HLine(7)
|
||||
VLine(89)
|
||||
DispGraph
|
||||
getKeyʳ
|
||||
Fix 4
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
(lib 'matrix)
|
||||
|
||||
(define (mtable i j)
|
||||
(cond
|
||||
((and (zero? i) (zero? j)) "😅")
|
||||
((= i 0) j)
|
||||
((= j 0) i)
|
||||
((>= j i ) (* i j ))
|
||||
(else " ")))
|
||||
|
||||
(array-print (build-array 13 13 mtable))
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
' FB 1.05.0 Win64
|
||||
|
||||
Print " X|";
|
||||
For i As Integer = 1 To 12
|
||||
Print Using "####"; i;
|
||||
Next
|
||||
|
||||
Print
|
||||
Print "---+"; String(48, "-")
|
||||
|
||||
For i As Integer = 1 To 12
|
||||
Print Using "###"; i;
|
||||
Print"|"; Spc(4 * (i - 1));
|
||||
For j As Integer = i To 12
|
||||
Print Using "####"; i * j;
|
||||
Next j
|
||||
Print
|
||||
Next i
|
||||
|
||||
Print
|
||||
Print "Press any key to quit"
|
||||
Sleep
|
||||
29
Task/Multiplication-tables/Lasso/multiplication-tables.lasso
Normal file
29
Task/Multiplication-tables/Lasso/multiplication-tables.lasso
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
define printTimesTables(max::integer) => {
|
||||
local(result) = ``
|
||||
local(padSize) = string(#max*#max)->size + 1
|
||||
|
||||
// Print header row
|
||||
#result->append((' ' * #padSize) + '|')
|
||||
loop(#max) => {
|
||||
#result->append(loop_count->asString(-padding=#padSize))
|
||||
}
|
||||
#result->append("\n" + (`-` * #padSize) + '+' + (`-` * (#padSize * #max)))
|
||||
|
||||
with left in 1 to #max do {
|
||||
// left column
|
||||
#result->append("\n" + #left->asString(-padding=#padSize) + '|')
|
||||
|
||||
// Table results
|
||||
with right in 1 to #max do {
|
||||
#result->append(
|
||||
#right < #left
|
||||
? ' ' * #padSize
|
||||
| (#left * #right)->asString(-padding=#padSize)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return #result
|
||||
}
|
||||
|
||||
printTimesTables(12)
|
||||
12
Task/Multiplication-tables/Nim/multiplication-tables.nim
Normal file
12
Task/Multiplication-tables/Nim/multiplication-tables.nim
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import strfmt
|
||||
|
||||
const n = 12
|
||||
|
||||
for j in 1..n:
|
||||
stdout.write "{:3d}{:s}".fmt(j, if n-j>0: " " else: "\n")
|
||||
for j in 0..n:
|
||||
stdout.write if n-j>0: "----" else: "+\n"
|
||||
for i in 1..n:
|
||||
for j in 1..n:
|
||||
stdout.write if j<i: " " else: "{:3d} ".fmt(i*j)
|
||||
echo "| {:2d}".fmt(i)
|
||||
11
Task/Multiplication-tables/Phix/multiplication-tables.phix
Normal file
11
Task/Multiplication-tables/Phix/multiplication-tables.phix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
printf(1," | ")
|
||||
for col=1 to 12 do
|
||||
printf(1,"%4d",col)
|
||||
end for
|
||||
printf(1,"\n--+-"&repeat('-',12*4))
|
||||
for row=1 to 12 do
|
||||
printf(1,"\n%2d| ",row)
|
||||
for col=1 to 12 do
|
||||
printf(1,iff(col<row?" ":sprintf("%4d",row*col)))
|
||||
end for
|
||||
end for
|
||||
11
Task/Multiplication-tables/Ring/multiplication-tables-1.ring
Normal file
11
Task/Multiplication-tables/Ring/multiplication-tables-1.ring
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
multiplication_table(12)
|
||||
func multiplication_table n
|
||||
nSize = 4 See " | "
|
||||
for t = 1 to n see fsize(t, nSize) next
|
||||
see nl + "----+-" + copy("-", nSize*n) + nl
|
||||
for t1 = 1 to n
|
||||
see fsize(t1, nSize) + "| "
|
||||
for t2 = 1 to n if t2 >= t1 see fsize(t1*t2,nSize) else see copy(" ", nSize) ok next
|
||||
see nl
|
||||
next
|
||||
func fsize x,n return string(x) + copy(" ",n-len(string(x)))
|
||||
14
Task/Multiplication-tables/Ring/multiplication-tables-2.ring
Normal file
14
Task/Multiplication-tables/Ring/multiplication-tables-2.ring
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
| 1 2 3 4 5 6 7 8 9 10 11 12
|
||||
----+-------------------------------------------------
|
||||
1 | 1 2 3 4 5 6 7 8 9 10 11 12
|
||||
2 | 4 6 8 10 12 14 16 18 20 22 24
|
||||
3 | 9 12 15 18 21 24 27 30 33 36
|
||||
4 | 16 20 24 28 32 36 40 44 48
|
||||
5 | 25 30 35 40 45 50 55 60
|
||||
6 | 36 42 48 54 60 66 72
|
||||
7 | 49 56 63 70 77 84
|
||||
8 | 64 72 80 88 96
|
||||
9 | 81 90 99 108
|
||||
10 | 100 110 120
|
||||
11 | 121 132
|
||||
12 | 144
|
||||
13
Task/Multiplication-tables/Sidef/multiplication-tables.sidef
Normal file
13
Task/Multiplication-tables/Sidef/multiplication-tables.sidef
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
var max = 12;
|
||||
var width = (max**2 -> len+1);
|
||||
|
||||
func fmt_row(*items) {
|
||||
items.map { |s| "%*s" % (width, s) }.join('');
|
||||
}
|
||||
|
||||
say fmt_row('x┃', (1..max)...);
|
||||
say "#{'━' * (width - 1)}╋#{'━' * (max * width)}";
|
||||
|
||||
max.times { |i|
|
||||
say fmt_row("#{i}┃", (1..max).map {|j| i <= j ? i*j : ''}...);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue