func reverse(x int) int { var temp int for x != 0 { remainder := x % 10 x/=10 temp = temp*10 + remainder } return temp }