0

Can anyone tell me Why this doesn't work for the snail in the well task?

https://code.sololearn.com/cs2Ud5hpFdLw/?ref=app

22nd May 2021, 1:28 PM
Unknown Guy
2 Réponses
+ 1
function main() { var depth = parseInt(readLine(), 10); //your code goes here let distance = 0; let days = 0; do { distance += 7; days++; if(distance >= depth){ break; } distance -= 2; } while(distance < depth ); console.log(days); }
22nd May 2021, 1:56 PM
Mounzer
0
A simple one line of code should solve the problem: Console.log(Math.round(depth / 5);
1st Jun 2021, 8:28 PM
Doriiion
Doriiion - avatar