Quiero saber porque no lo acepta como bien resuelto | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Quiero saber porque no lo acepta como bien resuelto

fun main(args: Array<String>) { var hours = readLine()!!.toInt() var total: Double = 1.0 when { hours<=5->total=1.toDouble() hours==24->total=15.toDouble() hours>5 && hours>24->total=(hours-24)*0.5+15 hours>5 && hours<24->total=(hours-5)*0.5+5 } println(total) }

22nd Apr 2021, 10:09 PM
matias gonzalez
matias gonzalez - avatar
2 Answers
+ 3
Si las horas <= 5, deberían ser hours * 1.0, no 1.0 Si las horas son 49, debería ser 49/24 * 15.0 + 49% 24 * 0.5 = 30.5, no 15.0 + (49-24) * 0.5 = 27.5
23rd Apr 2021, 1:22 AM
Simba
Simba - avatar
+ 1
Gracias, ya me había percatado del error, es bueno saber que hay gente dispuesta a ayudar
23rd Apr 2021, 1:52 AM
matias gonzalez
matias gonzalez - avatar