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
13
Task/Matrix-transposition/Nim/matrix-transposition-1.nim
Normal file
13
Task/Matrix-transposition/Nim/matrix-transposition-1.nim
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
proc transpose[X, Y; T](s: array[Y, array[X, T]]): array[X, array[Y, T]] =
|
||||
for i in low(X)..high(X):
|
||||
for j in low(Y)..high(Y):
|
||||
result[i][j] = s[j][i]
|
||||
|
||||
let b = [[ 0, 1, 2, 3, 4],
|
||||
[ 5, 6, 7, 8, 9],
|
||||
[ 1, 0, 0, 0,42]]
|
||||
let c = transpose(b)
|
||||
for r in c:
|
||||
for i in r:
|
||||
stdout.write i, " "
|
||||
echo ""
|
||||
Loading…
Add table
Add a link
Reference in a new issue