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
11 Respuestas
- 1
Chandan Chhetry
Don't write complex code. Solutions are already given in shared thread.
+ 5
show your attempt first
+ 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
+ 2
ok
+ 2
ok
+ 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
+ 1
Chandan Chhetry
Use search option to get solution
https://www.sololearn.com/discuss/2665192/?ref=app
https://www.sololearn.com/discuss/2618113/?ref=app
https://www.sololearn.com/discuss/2617598/?ref=app
https://www.sololearn.com/discuss/2624694/?ref=app
https://www.sololearn.com/discuss/2690678/?ref=app
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)
}
0
Why are you returning ?!
0
Rishav Tiwari
Yes always try to do self but try in more ways. There maybe many ways to solve one problem.