program displays the first and last number in the series. Java code example Example: find last digit of number //C++ int last_digit = number % 10;