GO Solution For UVa 10162 - Last Digit. In this post we will see how we can solve this challenge in GoLang for UVa Online Judge.

Problem Description

Give you a integer number N (1 ≤ n ≤ 2 ∗ 10100). Please compute

S = 11 + 22 + 33 + . . .+NN

Give the last digit of S to me.

Input Input file consists of several N ’s, each N a line. It is ended with N = 0.

Output For each N give a line containing only one digit, which is the last digit of S.

Sa

...

You can find the full details of the problem Last Digit at UVa Online Judge

Sample Input

1
2
3
0

Sample Output

1
5
2

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

Solution originally posted at: Github by @codingsince1985