Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4
We do not solve tasks, assignments etc. for others. Try to write a code and: if there is an error which you cannot fix, ask us and do not forget to share your code (so we can help); if everything is normal but you do not clearly understand code's logic, ask us to explain it.
23rd Jan 2021, 7:08 PM
#0009e7 [get]
#0009e7 [get] - avatar
+ 4
Finally solved by myself 😲 i have used ToFinal() To convert floating point into round figures
23rd Jan 2021, 7:54 PM
Zeeshan
+ 3
Press the "Solve" button and write the code that does what described in assignment. If you cannot do it right, paste your code to question and ask us to help you with fixing the error(s).
23rd Jan 2021, 7:17 PM
#0009e7 [get]
#0009e7 [get] - avatar
+ 3
Question is asking that a snail climbed a well upto certain feet to get out of it, in Day he climbed 7 feet but at night he slipped back by 2 feet, so basically it climbed 5 feet in a full day, Now suppose the snail had to climb 30 feet to get out of well, so it would take him 5+5+5+5+5+7=32 which is greater than 30 and that means it took it 6 days, 7 is there because on 6th day snail didn't need to climb at night. Suppose if height was 33, so it would mean the snail had to climb that night as well meaning 5+5+5+5+5+5+7, so it would took him a extra day. Now implementing is quite tricky, if you can't implement it I will then write the code but also I can't say at all that my answer would be efficient or the only way to do it.
23rd Jan 2021, 7:39 PM
Abhay
Abhay - avatar
+ 1
Not getting the logic
23rd Jan 2021, 7:15 PM
Zeeshan
+ 1
Zeeshan It seems your question appears to be an assignment. Please show us your attempt and use the 8 rules to get help from the community. https://www.sololearn.com/Blog/38/8-simple-rules-to-get-help-from-the-community *can be a code coach solution which is meant for you to do to help you establish your skills abilities and where you need to learn... not the community *one issued by a school or other institution *one issued or created by another platform *one that appears to be in the form of a challenge that was created by you or somewhere else. Your question will be reviewed by a team of moderators and will most likely be marked for deletion. https://www.sololearn.com/Discuss/1316935/?ref=app
20th Feb 2021, 5:30 PM
BroFar
BroFar - avatar
0
My final answer is this function main() {     var depth = parseInt(readLine(), 10);     //your code goes here     let distSum=0;     let disPdy=0;     let disPnyt=0;     let days=0;     for(let i=2 ;i<depth; i+=5){         days+=1;         disPdy+=7;         disPnyt-=2;         distSum =disPdy+disPnyt;                 }       //  if (distSum>depth ){             console.log(`${days}`)         }
7th Feb 2021, 5:19 AM
Luul Tesfay
Luul Tesfay - avatar