- 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
function main() { var depth = parseInt(readLine(), 10); //your code goes here let count =Math.floor (depth / 5); let rem = depth % 5; if ( rem == 3 || rem == 4){ count ++; } console.log(count); }
1 Answer
+ 1
function main() {
var depth = parseInt(readLine(), 10);
//your code goes here
var s=0;
var days=0 ;
while (s<=depth) ;
{
document.write(days);
s=s+7-2 ;
days++ ;
console.log(days);
}
}