+ 4

I can't get why there is spamming in output ?

https://code.sololearn.com/cNF0CQcX77p7/?ref=app

10th Aug 2020, 2:00 PM
Shubham Ingale
Shubham Ingale - avatar
4 Answers
+ 3
10th Aug 2020, 3:47 PM
Shubham Ingale
Shubham Ingale - avatar
+ 2
3 will always smaller than 5
10th Aug 2020, 2:05 PM
durian
durian - avatar
+ 2
The first while loop will always be false hence the print("ok") is skipped In second loop it will print &&& until 3<=5 which will always remain true and hence it will run infinitely (till timed out)
10th Aug 2020, 3:32 PM
Amit Kumar
Amit Kumar - avatar
0
You have no termination condition for while loop. So it infinite loops.. First condition in loop is false so don't get execute. Second loop condition is always true. So infinite loop.
10th Aug 2020, 2:46 PM
Jayakrishna 🇼🇳