Coding challenge

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: use getdigit(x,n) to return the n$^{th}$ digit from the right of a number x. Ex: getdigit(1234,2) returns 3.

Type your code here:


Lua reference

See your results here:

Show a friend, family member, or teacher what you've done!

Here is a share link to your code: