I did this once for a class I took. You might try putting it all in a while loop, such as: while (guesses[y] != mynumber)