Reverse the Number

Published by CppPythonDude in

Create a function that takes an integer n and reverses it.

Examples

rev(5121) ➞ "1215"

rev(69) ➞ "96"

rev(-122157) ➞ "751221"

Notes

  • This challenge is about using two operators that are related to division.
  • The result is just a string, so you don't need to use pow(double a, double b) or other trickery for the output.
  • If the number is negative, treat it like it's positive.
Watch a quick demo on how Edabit works.