+ 1

The snail climbs up 7 feet each day and slips back 2 feet each night. How many days will it take the snail to get out of a wel

Please I need a way to compose the code...but it's just stuck

25th Aug 2022, 1:40 PM
BÉLÏ3VÉR
BÉLÏ3VÉR - avatar
3 Answers
+ 2
function main() { var depth = parseInt(readLine(), 10); //your code goes here var i=0; for (; depth > 0;) { i++; depth -= 7 if (depth > 0) { depth += 2 } } console.log(i); } It's from JavaScript I've done it earlier
25th Aug 2022, 1:43 PM
Random
Random - avatar
+ 2
25th Aug 2022, 6:04 PM
Chris Coder
Chris Coder - avatar
0
Thank you But please can you explain Snehil Pandey
25th Aug 2022, 1:46 PM
BÉLÏ3VÉR
BÉLÏ3VÉR - avatar