Write some code to find how many three-digit numbers satisfy the property that the middle digit is the average of the first and the last digits. (Ans: 45.) (AMC 12A 2005.) Hint: usegetdigit(x,n)to return the n$^{th}$ digit from the right of a numberx. Ex: getdigit(1234,2) returns 3.

See your results here: