So this is my code so far.
public int getsum (int n){ int num = 23456; int total = 0; while (num != 0) { total += num
I see a lot of solutions on here, but not one in which seems as simple as what follows. I've tested it countless times and it works no problem:
public int sumDigits(int n) { if (n == 0){ return 0; } else{ return n%10 + sumDigits(n/10); } }