input: Write a function to reverse an integer.
  assert reverse_integer(12345) == 54321
  assert reverse_integer(9876) == 6789
  assert reverse_integer(1001) == 1001
output: def reverse_integer(n):
      reversed_n = 0
      while n > 0:
          digit = n % 10
          reversed_n = reversed_n * 10 + digit
          n //= 10
      return reversed_n