0

Please why it keep asking me the user input? Instead of printing the result?

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

28th Oct 2023, 7:58 AM
SAGIR ISAH
SAGIR ISAH - avatar
2 Antworten
+ 3
There are few reasons why it keep asking for input. 1. You used a while loop. 2. In order to break the loop, you set the criteria which require both expression (x % num and x % num2) to be False. 3. The expressions need to be 0 to become False. With the right combination and repeatedly enter the same input the code will break and print the result. For example, num is 4 and num2 is 6. It requires 12 times of input (4 & 6) to break the loop. When the loop reached the 12th times, x become 12 and x is dividable by both 4 and 6.
28th Oct 2023, 8:38 AM
Wong Hei Ming
Wong Hei Ming - avatar
+ 1
or you can enter 1 for num and 1 for num2
28th Oct 2023, 10:48 AM
Bob_Li
Bob_Li - avatar