PLS WHAT IS WRONG WITH THE CODE | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

PLS WHAT IS WRONG WITH THE CODE

function main() { var depth = parseInt(readLine(), 10); //your code goes here days = 0 feetMovedUpByDay = 7; feetMovedUpByNight = 2; feetMovedTotal = 0 for(feetMovedTotal = 0; feetMovedTotal != depth; feetMovedTotal += 7){ if (feetMovedTotal !== depth) { if (feetMovedTotal + 7 !== depth) { feetMovedTotal += 7 } if (feetMovedTotal -2 !== depth) { feetMovedTotal -= 2 } } days += 1; } console.log(days) }

27th Jul 2021, 4:07 PM
Ejiofor Celestine
Ejiofor Celestine - avatar
2 Answers
+ 4
after for loop in if condition it should ve feetMovedToral != depth instead of !==
27th Jul 2021, 4:19 PM
syscall
syscall  - avatar
0
TNX
27th Jul 2021, 4:27 PM
Ejiofor Celestine
Ejiofor Celestine - avatar