The first digit of a three-digit number n of type int is (n / 100), the second digit is ((n % 100) / 10) and the third one is (n % 10).

To find the magic number, it is possible to search through all three-digit numbers. On modern computers, this is instantaneous.