## Puzzle

Today, a close relative tried to boggle my mind by sending a link to this fantastic puzzle: http://digicc.com/fido/

Well, it was clever, but not super difficult to solve.The secret is the subtraction operation and 9 as a strange number with awesome mathematical characteristics. When you subtract two numbers with same digits, but jumbled as in this puzzle, the result is always divisible by nine(e.g.198 or 7974 in the following examples). Summing up all the digits in the result number will also make a new number divisible by nine(1+9+8=18, 7+9+7+4=27 ). From here onwards, finding out the missing (circled) digit is just 10 lines of code plus some Flash/UI talents

1) Here is the pattern for 3 digit numbers:

Let’s assume that you have entered 198 (As the result of subtraction for 321-123)

if you have circled 1 >> 98 >> 9+8 =17 >> 1+7 = 8 >> 9-8 = 1 >>Answer: **1**

if you have circled 9>> 18 >> 1+8 =9 >> Since it is a single digit number, there is no need for additional steps>> Answer : **9**

if you have circled 8>> 19 >> 1+9=10 >> 1+0 = 1 >> 9-1 =8 >> Answer :**8**

2) Here is the pattern for 4 digit numbers:

Let’s assume that you have entered 7974 (As the result of subtraction for 9213-1239):

if you have circled 7 >> 974 >> 9+7+4 =20 >> 2+0= 2 >> 9-2 = 7 >>Answer: **7**

if you have circled 9>> 774 >> 7+7+4 =18 >> 1+8 = 9 >> Since it is a single digit number, there is no need for additional steps >> Answer : **9**

if you have circled the second 7>> 974 >> 9+7+4 =20 >> 2+0= 2 >> 9-2 = 7 >>Answer: **7**

if you have circled 4>> 797 >> 7+9+7 =23 >> 2+3 =5 >> 9-5 = 4 >>Answer: **4**

Try it out , it is fun!