How can i solv the snail in the well in >>>> JavaScript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can i solv the snail in the well in >>>> JavaScript

4th Apr 2021, 7:32 AM
Osama Maz
Osama Maz - avatar
2 Answers
+ 2
function main() { var depth = parseInt(readLine(), 10); //tu código va aquí var d = 0; // días var c = 0; // caracol while (c < depth) { c += 7 - 2; d += 1; if (c > depth) { if (c - 2 <= depth) { console.log(d); break; } else if (c > depth) { console.log(d - 1); break; } } } }
6th Jun 2021, 6:41 PM
Kevin Alexander Alvarez Echeverri
Kevin Alexander Alvarez Echeverri - avatar