Python 풀이
def solution(x):
nums = list(map(int, str(x)))
if x % sum(nums) == 0:
return True
return False
Java 풀이
class Solution {
public boolean solution(int x) {
boolean result = false;
int num = x;
int sum = 0;
while (num >= 1) {
sum += num % 10;
num /= 10;
}
if (x % sum == 0) {
result = true;
}
return result;
}
}