+ 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
3 Antworten
+ 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
+ 2
It is a good Idea to use the search before posting any questions
You can many explanations here.
https://www.sololearn.com/Discuss/2663772/?ref=app
https://www.sololearn.com/discuss/2618113/?ref=app
https://www.sololearn.com/discuss/2617598/?ref=app
0
Thank you
But please can you explain Snehil Pandey