+ 1
Why this code not gives expected output
var depth = parseInt(readLine(), 10); //your code goes here var days = 0; var dist = 0; while (dist <= depth) { dist +=7 if(dist<depth) dist -=2 days++ } console.log(days);
2 Answers
+ 3
Why is it dist <= depth and not dist < depth?
+ 2
What will happen if depth is 6?