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 | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
- 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); }

29th Sep 2022, 5:15 AM
SYED AHMED
SYED AHMED - avatar
1 ответ
+ 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); } }
29th Sep 2022, 8:51 AM
Sreeju
Sreeju - avatar