+ 2
Need help what is the error in my code?
When I am executing this code the output is "Time limited Exceed" Why please help! https://code.sololearn.com/czvZS6LKM0oR/?ref=app
4 Respuestas
+ 4
And now you've changed your code and moved the * 100 up to Math.random() which will also solve the casting problem, but you also changed the text output in the else block and have forgotten to add back your break statement, once again creating an infinite loop, but this time with some output.
+ 3
You have an infinite loop.
r is cast to an int prior to r being multiplied by 100. Making dod always equal to 0 which is less than 21 so the continue statement is ran.
To fix surround r*100 in parenthesis.
dod=(int)(r*100);
+ 2
thx I will add
+ 1
Done!