+ 1

The snail in the well

function main() { var depth = parseInt(readLine(), 10); //your code goes here for (depth+7-2; depth<=6;i++) { console.log(depth) } } =no ouput

8th Nov 2021, 5:36 AM
Wera Wera
Wera Wera - avatar
3 Respostas
+ 3
You need to review how to write a for loop, your syntax does not make sense. You never declared the i variable, just try incrementing it in the loop, but in JavaScript it means the value is undefined.
8th Nov 2021, 6:12 AM
Tibor Santa
Tibor Santa - avatar
+ 2
function main() { var depth = parseInt(readLine(), 10); //your code goes here var depthCover = 0; for (day = 1; day<=depth; ++day){ if (depth - depthCover > 7){ depthCover += 5; }else { break; } } console.log(day) }
13th Nov 2021, 8:54 AM
Abdisalam Hassan
Abdisalam Hassan - avatar