3099. Harshad Number Poison 2024-07-04 123456789101112131415class Solution { public int sumOfTheDigitsOfHarshadNumber(int x) { int sum = 0, tmp = x; while (tmp > 0) { sum += tmp % 10; tmp /= 10; } if (x % sum == 0) { return sum; } else { return -1; } }} Reference3099. Harshad Number