- 3
Help?
I need help with the snail exam. I don't understand
5 Antworten
+ 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.
+ 1
Lucas Rojas I didn't saw your attempt in the thread before now.
+ 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)
}
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
0
That's my eleventh try lol. I tried many times.