Help? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
- 3

Help?

I need help with the snail exam. I don't understand

9th Aug 2021, 8:01 PM
Lucas Rojas
Lucas Rojas - avatar
5 Réponses
+ 3
Snail climbs 7 feet in day and slips 2 feet at night . Take a counter and begin a while loop. Make the snail climb 7 feet, increment counter and check if the snail climbed the given height fully , if it didn't then slip it by 2 feet , otherwise break the loop.
9th Aug 2021, 8:17 PM
Abhay
Abhay - avatar
+ 1
Lucas Rojas I didn't saw your attempt in the thread before now.
9th Aug 2021, 9:17 PM
Jan
Jan - avatar
+ 1
Lucas Rojas Take a look at this....... function main() { var depth = parseInt(readLine(), 10); var days = 0; for (x = 1; x <= depth; x++) { days += 7; if (days >= depth) { break; } else { days -= 2; } } console.log(x) }
9th Aug 2021, 9:24 PM
Jan
Jan - avatar
0
function main() { var depth = parseInt(readLine(), 10); var x = 42 while (x >= 8){ document.write(6); x++; } } function main() { var depth = parseInt(readLine(), 10); var x = 42 while (x >= 8){ document.write(6); x++; } } I don't know
9th Aug 2021, 8:27 PM
Lucas Rojas
Lucas Rojas - avatar
0
That's my eleventh try lol. I tried many times.
9th Aug 2021, 8:42 PM
Lucas Rojas
Lucas Rojas - avatar