+ 1
Help to decide the number 23 task fully)
function main() { var depth = parseInt(readLine(), 10); var days=0; var s=0; while (days<=depth){ days+=5; s+=1; } console.log(s); }
5 Antworten
+ 2
The snail climbs up 7 feet each day and slips back 2 feet each night.
You need to check the distance to depth and not days. And each time 5 must be not true.
+ 2
„The snail climbs up 7 feet each day and slips back 2 feet each night“ that means you have two time points first before night and second after. For this reason you have to check the reached distance in the loop for the two sytuations. When dept is reached you can print the number of days, what is searched for here.
+ 1
Ask, please, which I get started. Should I do to use boolean true/false conditionals to reach right answer?
+ 1
You might want to reconsider the logic of your algorithm.
Unless you want to see my solution.
0
I'm not want to get solution right now, I 'd like to understand how to do this, to get something hints.