0

# 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

9th Apr 2021, 2:00 PM
Chandan Chhetry
11 odpowiedzi
- 1
Chandan Chhetry Don't write complex code. Solutions are already given in shared thread.
10th Apr 2021, 4:15 AM
A͢J
+ 5
9th Apr 2021, 2:05 PM
ÃKR
+ 4
As Akr bro said, your try is also important so that we can tell you where you are wrong! Hint : loop will climb and condition will fall you down
9th Apr 2021, 2:10 PM
Abhiyantā
9th Apr 2021, 2:42 PM
Arun Ruban SJ
+ 2
ok
9th Apr 2021, 2:11 PM
Chandan Chhetry
+ 2
ok
10th Apr 2021, 3:57 AM
Chandan Chhetry
+ 2
Right 🅰🅹 (Challenge Accepted) Sir!! But I think Chandan Chhetry have to try with his own effort this, to take the real benefit of practice!! Don't write complex code as Sir said but try to make by your own
10th Apr 2021, 4:18 AM
Abhiyantā
9th Apr 2021, 3:59 PM
A͢J
0
my answer: function main() { var depth = parseInt(readLine(42), 10); //your code goes here var up=7; var dwn=2 while(depth){ case 1; var r=(up-dwn) return r case 2; var r2=((r+up)-dwn) return r2 case 3; var r3=((r2+up)-dwn) case 4; var r4=((r3+up)-dwn) case 5; var r5=((r4+up)-dwn) case 6; var r6=((r5+up)-dwn) } console.log(r6) }
10th Apr 2021, 3:25 AM
Chandan Chhetry
0
Why are you returning ?!
10th Apr 2021, 3:56 AM
Abhiyantā
0
Rishav Tiwari Yes always try to do self but try in more ways. There maybe many ways to solve one problem.
10th Apr 2021, 4:24 AM
A͢J