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
|
|
@ -0,0 +1,18 @@
|
|||
import Foundation
|
||||
|
||||
print("Enter 11 numbers for the Trabb─Pardo─Knuth algorithm:")
|
||||
|
||||
let f: (Double) -> Double = { sqrt(fabs($0)) + 5 * pow($0, 3) }
|
||||
|
||||
(1...11)
|
||||
.generate()
|
||||
.map { i -> Double in
|
||||
print("\(i): ", terminator: "")
|
||||
guard let s = readLine(), let n = Double(s) else { return 0 }
|
||||
return n
|
||||
}
|
||||
.reverse()
|
||||
.forEach {
|
||||
let result = f($0)
|
||||
print("f(\($0))", result > 400.0 ? "OVERFLOW" : result, separator: "\t")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue