0

Почему цикл бесконечный, если не "depth-=5"?

function main() { var depth = parseInt(readLine(), 10); //ваш код var day=0; while(depth>2){ day++; depth-5; } console.log(day); }

23rd Jan 2022, 10:33 AM
Leo
Leo - avatar
1 Odpowiedź
+ 1
Leo , because you didn't assign the value of depth anywhere. In the loop it should be => depth = depth - 5 or depth -= 5.
23rd Jan 2022, 10:39 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar