if ((confirm + remainder)==ticket)

Of course this doesn't work. If first number is 12345 and second number is 1234 then 1234 + 5 = 1239 not 12345. It is much easier if you divide the first number...