0
It suppose to work?
https://code.sololearn.com/cqIq1ZO6kPb6/?ref=app Time limit... :(
2 Answers
+ 6
The guess number in your code has the value rand()%1, which will return 0 no matter what. So the guess loop is infinite and you get the Time Limit Exceeded Error.
Thus, change guess' value to rand()%10, and it will work fine.
Secondly, your loops should not run from 0 to 3, but just from 0 to 2, as pin[3] is an invalid index if the size of the array is 3. So change the loop conditions to x<3 from x<=3.
+ 1
@Kinshuk Vasisht
Thx it worked