Mercurial > lbo > hg > juliaplay
view julia/num.jl @ 30:9b19f04208e4
julia: num
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Sat, 04 Mar 2023 22:10:49 +0100 |
parents | |
children |
line wrap: on
line source
function reverse_digits(n::Integer) pot = floor(Int, log10(n)) d = 0 for i = pot:-1:0 dig = div(n, 10^i) if dig == 0 continue end d += dig * 10^(pot-i) n = rem(n, (dig * 10^i)) end d end