- 2

How can i program this ? In Java script

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 well with the given depth? Sample Input: 31 Sample Output: 6 Explanation: Let's break down the distance the snail covers each day: Day 1: 7-2=5 Day 2: 5+7-2=10 Day 3: 10+7-2=15 Day 4: 15+7-2=20 Day 5: 20+7-2=25 Day 6: 25+7=32 So, on Day 6 the snail will reach 32 feet and get out of the well at day, without slipping back that night. https://www.sololearn.com/discuss/3023276/?ref=app https://www.sololearn.com/discuss/3022631/?ref=app https://www.sololearn.com/discuss/3022930/?ref=app https://www.sololearn.com/discuss/3023073/?ref=app https://www.sololearn.com/discuss/3023523/?ref=app https://www.sololearn.com/discuss/3022902/?ref=app https://www.sololearn.com/discuss/3023206/?ref=app https://www.sololearn.com/discuss/3022872/?ref=app https://www.sololearn.com/discuss/3023625/?ref=app https://www.sololearn.com/discuss/3023516/?ref=app https://www.sololearn.com/discuss/3

26th Apr 2022, 4:53 AM
Ermias Molla G/Giorgis
Ermias Molla G/Giorgis - avatar
2 Answers
0
You tagged some post what dont talk about this question, you could just look for this question and find answer insted. Here is some: https://www.sololearn.com/discuss/2665192/?ref=app https://www.sololearn.com/discuss/2768638/?ref=app https://www.sololearn.com/discuss/2618113/?ref=app https://www.sololearn.com/discuss/2624694/?ref=app
26th Apr 2022, 5:30 AM
PanicS
PanicS - avatar
0
Tnx
26th Apr 2022, 8:39 AM
Ermias Molla G/Giorgis
Ermias Molla G/Giorgis - avatar