+ 1
Parking Fee (Kotlin) , Do I've any error in this code ?
fun main(args: Array<String>) { var hours = readLine()!!.toInt() var total: Double = 0.0 var i:Int = 0 if (hours in 0..23) { while (hours >= 5) { hours -= 5 i++ break } total += (hours * 0.5) + i*5 println(total) } else { while (hours >= 24) { hours -= 24 i++ } total += (hours * 0.5) + i*15 println(total) } }
2 Antworten
+ 4
Yes,
There is no output if hours < 5
0
Simba show solution lets see