What's the problem in my code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's the problem in my code

Here is my code: fun main(args: Array<String>) { var hours = readLine()!!.toInt() var total: Double = 0.0 if (hours<=5){ println(hours) } else if (hours>5 && hours<24){ println(5+(hours-5)*.5) } else{ println(((hours-hours%24)/24)*15 + (hours%24)*.5) } } . Only one test failed number 4

30th Aug 2022, 4:31 AM
M.A. Masud Karim Nayeem
2 Answers
0
M.A. Masud Karim Nayeem Why hours - hours%24? why not just (hours / 24) because we need exact hours
30th Aug 2022, 6:52 AM
A͢J
A͢J - avatar
0
Cz that will be point value like 2.33 or something..we need full number
30th Aug 2022, 2:29 PM
M.A. Masud Karim Nayeem