GO Solution For UVa 10018 - Reverse and Add. In this post we will see how we can solve this challenge in GoLang for UVa Online Judge.

Problem Description

The “reverse and add” method is simple: choose a number, reverse its digits and add it to the original. If the sum is not a palindrome (which means, it is not the same number from left to right and right to left), repeat this procedure.

For example:

195 Initial number 591 —– 786 687 —–

1473 3741

...

You can find the full details of the problem Reverse and Add at UVa Online Judge

Sample Input

3
195
265
750

Sample Output

4 9339
5 45254
3 6666

Solution: Please check the main.go snippet for the solution.

Solution originally posted at: Github by @codingsince1985