solved yet another number game in C, Python and Java