0

Can I know where I am going wrong in the code because out of 5. 3 are correct and 2 are wrong. It’s snail climb project.

function main() { var depth = parseInt(readLine(), 10); //your code goes here var i=0; var up=7 var down=2 var day=5 var days=0 while (i<depth){ i+=day days++ }console.log(days) }

5th Sep 2022, 5:45 PM
Joshua Nochina
1 Réponse
+ 1
Rethink Condition : Snail Climb 7 feets. If it not reached destination, then only it falls 2 feets. .. This repeated until reaching destination. Where are using values for up, down?
5th Sep 2022, 6:16 PM
Jayakrishna 🇮🇳