Actually
%
= mod
the result of 123 % 10 is 3 as mod equals the remainder only.
num
is an int. and so can't hold any decimal places
the result of int / int is always an int (rounded down as the decimal place is just lost)
so 123 / 10 = 12
so what this does is take the last digit and add it to the total until there are no digits left:
sum = 0;
num = 123;
pass1:
r = 123%10 = 3
num = 123/10 = 12
sum = 3
pass2:
r = 12%10 = 2
num = 123/10 = 1
sum = 5
pass3:
r = 1%10 = 1
num = 123/10 = 0
sum = 6
pass4:
terminated as num = 0
I hope that helps
Andy ^_^