- 4
program in javascript
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?
7 Antworten
+ 5
Avantika Damdhar 
The QUESTIOn isn't clear.. the attempt isn't there.. there's no elaboration..
Yet you think that we can help you exactly what you are willing for?
+ 4
Avantika Damdhar First show your attempts.
+ 2
DIY ( Do It Yourself )
+ 2
Suppose your input is 32. In one day the snail progress is 7-2 = 5 inch. You need 30/5= 6 days to finish . The 2 inch remainder will be finished in the next day. So the, total days is 6 + 1 = 7 days. Hope it simple and helpful.
+ 1
answer is
function main() {
    var depth = parseInt(readLine(), 10);
    //your code goes here
    var rem=depth%5;
    if(rem>2){
    var result=(depth-rem);
   console.log((result/5)+1);
   }
   else {
       var result=(depth-rem);
       console.log(result/5);
   }
}
0
function main() {
    var depth = parseInt(readLine(), 10);
    //your code goes here
    var rem=depth%5;
    var result=(depth-rem);
    
   console.log((result/5)+1);
}
0
Hi Avantika Damdhar can you elaborate ho you solved that? Thanks



