+ 2
Can someone pls explain whats wrong with this code?
function main() { var depth = parseInt(readLine(), 10); //your code goes here var up=7-2; var hg=0; var days=0; do{ hg=hg+up; days=days+1; if(hg>depth){ break; } } while (hg<=depth ); console.log(days); } Above is the Js project from loops,the answer should be 8,but it shows 9.
4 Antworten
+ 2
Where is problem description ?
https://www.sololearn.com/discuss/333866/?ref=app
+ 2
// I've fixed them below
do {
hg+=up;
if(hg>depth) break;
days++;
} while (hg<=depth);
+ 2
Jayakrishna🇮🇳 thank you for ur support .
+ 1
SoloProg thank you for ur support too.