0

Can not decide

I have been trying to solve this problem for a very long time. I ask for help. You need to add the numbers in the range. fun main(args: Array<String>){ val lit1 = readLine() !!.toInt() val lit2 = readLine() !!.toInt() for (x in lit1..lit2){ } }

24th Apr 2021, 7:30 PM
Regaliv Derif
Regaliv Derif - avatar
2 Answers
+ 3
Regaliv Derif sum = 0 for (x in li1..lit2) { sum += x } println (sum)
24th Apr 2021, 7:47 PM
A͢J
A͢J - avatar
0
I didn’t think to deduce println(sum) from the loop body
24th Apr 2021, 7:52 PM
Regaliv Derif
Regaliv Derif - avatar