1int number; // = some int
2
3while (number > 0) {
4 print( number % 10);
5 number = number / 10;
6}
7
1sumOfDigit(n):
2 sum = 0
3 temp = 0
4 while n >= 1:
5 # temmp % 10 to get the rightmost digit
6 temp = n % 10
7 sum += temp
8 # n // 10 to get the the rest of digit except rightmost digit (198 // 10 = 19)
9 n //= 10
10