Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
15
Task/Middle-three-digits/ArkScript/middle-three-digits.ark
Normal file
15
Task/Middle-three-digits/ArkScript/middle-three-digits.ark
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
(import std.Math)
|
||||
(import std.String)
|
||||
|
||||
(let middle_three_digits (fun (i) {
|
||||
(let s (toString (math:abs i)))
|
||||
(if (and (math:odd (len s)) (>= (len s) 3))
|
||||
(string:slice s (- (/ (len s) 2) 1) 3)
|
||||
"Need odd and at least 3 digits") }))
|
||||
|
||||
(import std.List :forEach)
|
||||
|
||||
(forEach [123 12345 1234567 987654321 10001 -10001 -123 -100 100 -12345]
|
||||
(fun (x) (print (middle_three_digits x))))
|
||||
(forEach [1 2 -1 -10 2002 -2002 0]
|
||||
(fun (x) (print (middle_three_digits x))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue