Generate a Python program to reverse the digits of an integer.
n = 123
def reverse_int(n):
    rev = 0
    while n > 0:
        rem = n % 10
        rev = rev * 10 + rem
        n = n // 10
    return rev

n = 123
print(reverse_int(n))