Reverse a number
easyMaths and loops10 XP
Return the digits of n (0 or more) in reverse order, as a number: 120 becomes 21. Try it with % and // (JavaScript: Math.floor) instead of strings.
Examples
- Input: n = 1234Output: 4321
- Input: n = 120Output: 21
Examples use JSON: true/false/null are True/False/None in Python.