def reverse_int(num):
    """
    >>> reverse_int(123)
    321
    >>> reverse_int(685030)
    30586
    """
    result = 0
    while num > 0:
        result = result * 10 + num % 10
        num //= 10
    return result