Last Digit and the Rest
Easyjava
Read a non-negative integer and split it into its last digit and everything before it, using % 10 and / 10.
Input: one non-negative integer.
Output: one line: <last digit> <the number without its last digit>
Example 1
Input
472
Output
2 47
- 0 <= n <= 2000000000
Hint 1
n % 10 is the last digit.
Hint 2
n / 10 (integer division) drops the last digit.
% 10 isolates the units digit; / 10 shifts the number right by one digit. For a single-digit number, n / 10 is 0.