The Last Digit

A problem from the 1996 Georg Mohr mathematics competition in Denmark:

n is a positive integer. The next-to-last digit in the decimal expression of n2 is 7. What’s the last digit?

Click for Answer