+ 1
Kotlin
My answer was correct yet didn't work
4 Answers
+ 6
//try this
fun main(args: Array<String>) {
var hour = readLine()!!.toInt()
if(hour <= 18){
println("Open")
}
else if(hour <=24) {println("Closed")
}
}
+ 2
Simba I got it . I forgot that the answers "Open and Close" were case-sensitive . Thanks for drawing my attention đâșïž
+ 1
fun main(args: Array<String>) {
var hour = readLine()!!.toInt()
if(hour <= 18){
println("open")
}
else if(hour <=24) {println("closed")
}
else {print("hour must be between 0 and 24")}
}
+ 1
//efficient
fun main(args: Array<String>) {
var hour = readLine()!!.toInt()
if(hour <= 18){
println("open")
} else if(hour > 18 && hour <=24){
println("closed")
} else {
print("hour must be between 0 and 24")
}
}