Last Digit
Easy · rating 850 · Math
Read an integer n. Print its last (ones) digit, ignoring sign.
Editorial
Last Digit extracts the ones digit of a number, ignoring its sign: take the absolute value modulo 10.
print(abs(n) % 10)Complexity
Time: O(1). Space: O(1).
Related problems
- Array Sum — Easy
- Digital Root — Easy
- Even Numbers Up To N — Easy
- Shopping Cart Total — Easy
- Sum of Cubes — Easy
- Sum of Squares — Easy