If $n$ is represented as a bit string, then $n$ mod $10$ can be computed in time $O(\log n)$ (which is presumably what you meant when you wrote $O(n)$, i.e., you were calling $n$ is the number of bits of the parameter $n$, because otherwise complexity $O(n)$ would be absurdly large). Indeed, one can compute $n$ mod $10$ using a deterministic finite automaton with $10$ states, which is defined if $n$ is read starting from the big end, by having a transition from state $k$ to state $2k$ upon reading a $0$ and $k$ to $2k+1$ upon reading a $1$, where states are labeled mod $10$ (e.g., from state $6$ we move to state $2$ or $3$ according as we read a $0$ or $1$), and finally returning the final state after all bits are read. Obviously, this is done in linear time, i.e., $O(\log n)$.
The answer $O(\log n\, \log\log n)$ would be plausible if the parameter $10$ were not kept fixed and $n$ stands for the max of the two inputs (although I'm not sure we know how to do division that quickly; $O(\log n\, (\log\log n)^2)$ is more like it).