The following code splits an integer into separate digits. It then adds 7 to each of those digits, and then finds the remainder when the result is divided by ten. To do this it uses the Modulus operator.
It's a homework task that someone asked for help on, on StackOverflow, and I felt curious so I had a go at writing it myself.
I understand completely about what modulus does vis-à-vis fetching the remainder, but I don't understand why using the modulus operator gets you each digit individually?
for example, this snippet splits the digits of an integer - but how??
and why does number have to be reassigned as number / 10?
Apologies if this is stupid - I just can't wrap my head around it right now!