0

Hey Guys, Im doing JavaScript Challenge,"Snail's one

The point is, Im stuck.I dunno why I get an error,Just know that the problem it is In the program's end This my code:vec (times ,I mean days..) for(depth,vec=0;depth>0;vec++,depth=depth-5) if(depth<=0){ break; } console.log(vec)

16th Feb 2021, 2:35 AM
C0d3
C0d3 - avatar
4 Antworten
+ 1
Here is my code. This may help you. function main() { var depth = parseInt(readLine(), 10); //your code goes here var climb = 7; var slip = 2; var day = 0; for(workdone=0;workdone<=depth;) { day = day+1; workdone = workdone+climb; if(workdone>=depth){ break; } workdone = workdone-slip; } console.log(day); }
18th Feb 2021, 2:39 AM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 1
hi Christian Guerrero i think the issues is the amount of things in the for loop. try declaring somd variables outside the loop as well as moving depth into the for loop. also maybe use a while like me it’s just easier. their are other things with your math but you’ll fugure them out
16th Feb 2021, 4:11 AM
Ollie Q
Ollie Q - avatar
+ 1
Thats incredible Sathe Prerana Satish ,thank you so much ,it is very useful
18th Feb 2021, 2:57 AM
C0d3
C0d3 - avatar
0
Most welcome 👍
18th Feb 2021, 10:10 AM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar