RosettaCodeData/Task/Jensens-Device/Kotlin/jensens-device.kts
2024-10-16 18:07:41 -07:00

3 lines
140 B
Kotlin

fun sum(lo: Int, hi: Int, f: (Int) -> Double) = (lo..hi).sumByDouble(f)
fun main(args: Array<String>) = println(sum(1, 100, { 1.0 / it }))