class Solution {
public boolean solution(int x) {
int n =0;
String[] a=Integer.toString(x).split("");
// 숫자로 변환하여 한자리씩 더함
for (int i = 0; i < a.length; i++) {
n+=Integer.parseInt(a[i]);
}
if (x%n==0){
return true;
}
else return false;
}
}
앞서 구한 자릿수 더하기에서 한단계 추가된 문제